Learnpress_Helpers::all_lp_lessons( string $label = null, string $option_code = 'LPLESSON',  $any_option = true )


Parameters Parameters

$label

(Optional)

Default value: null

$option_code

(Optional)

Default value: 'LPLESSON'


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/learnpress/helpers/learnpress-helpers.php

	public function all_lp_lessons( $label = null, $option_code = 'LPLESSON', $any_option = true ) {
		if ( ! $this->load_options ) {

			return Automator()->helpers->recipe->build_default_options_array( $label, $option_code );
		}

		if ( ! $label ) {
			$label = esc_attr__( 'Lesson', 'uncanny-automator' );
		}
		$args = [
			'post_type'      => 'lp_lesson',
			'posts_per_page' => 9999,
			'orderby'        => 'title',
			'order'          => 'ASC',
			'post_status'    => 'publish',
		];

		$options = Automator()->helpers->recipe->options->wp_query( $args, $any_option, esc_attr__( 'Any lesson', 'uncanny-automator' ) );
		$option = [
			'option_code'     => $option_code,
			'label'           => $label,
			'input_type'      => 'select',
			'required'        => true,
			// to setup example, lets define the value the child will be based on
			'current_value'   => false,
			'validation_type' => 'text',
			'options'         => $options,
			'relevant_tokens' => [
				$option_code          => esc_attr__( 'Lesson title', 'uncanny-automator' ),
				$option_code . '_ID'  => esc_attr__( 'Lesson ID', 'uncanny-automator' ),
				$option_code . '_URL' => esc_attr__( 'Lesson URL', 'uncanny-automator' ),
			],
		];
		return apply_filters( 'uap_option_all_lp_lessons', $option );
	}