LP_MARKLESSONDONE::load_options()

Contents


Return Return

(array[])


Source Source

File: src/integrations/learnpress/actions/lp-marklessondone.php

	public function load_options() {
		$args    = array(
			'post_type'      => 'lp_course',
			'posts_per_page' => 999,
			'orderby'        => 'title',
			'order'          => 'ASC',
			'post_status'    => 'publish',
		);
		$options = Automator()->helpers->recipe->options->wp_query( $args, false, esc_attr__( 'Any course', 'uncanny-automator' ) );
		return Automator()->utilities->keep_order_of_options(
			array(
				'options_group' => array(
					$this->action_meta => array(
						Automator()->helpers->recipe->field->select_field_args(
							array(
								'option_code'              => 'LPCOURSE',
								'options'                  => $options,
								'label'                    => esc_attr__( 'Course', 'uncanny-automator' ),
								'required'                 => true,
								'custom_value_description' => esc_attr__( 'Course ID', 'uncanny-automator' ),
								'is_ajax'                  => true,
								'target_field'             => 'LPSECTION',
								'endpoint'                 => 'select_section_from_course_LPMARKLESSONDONE',
							)
						),
						Automator()->helpers->recipe->field->select_field_args(
							array(
								'option_code'              => 'LPSECTION',
								'options'                  => array(),
								'label'                    => esc_attr__( 'Section', 'uncanny-automator' ),
								'required'                 => true,
								'custom_value_description' => esc_attr__( 'Section ID', 'uncanny-automator' ),
								'is_ajax'                  => true,
								'target_field'             => $this->action_meta,
								'endpoint'                 => 'select_lesson_from_section_LPMARKLESSONDONE',
							)
						),
						Automator()->helpers->recipe->field->select_field_args(
							array(
								'option_code'              => $this->action_meta,
								'options'                  => array(),
								'label'                    => esc_attr__( 'Lesson', 'uncanny-automator' ),
								'required'                 => true,
								'custom_value_description' => esc_attr__( 'Lesson ID', 'uncanny-automator' ),
							)
						),
					),
				),
			)
		);
	}