LD_COURSEDONE::define_trigger()

Define and register the trigger by pushing it into the Automator object


Source Source

File: src/integrations/learndash/triggers/ld-coursedone.php

	public function define_trigger() {



		$trigger = array(
			'author'              => Automator()->get_author_name(),
			'support_link'        => Automator()->get_author_support_link( $this->trigger_code, 'integration/learndash/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - LearnDash */
			'sentence'            => sprintf( esc_attr__( 'A user completes {{a course:%1$s}} {{a number of:%2$s}} time(s)', 'uncanny-automator' ), $this->trigger_meta, 'NUMTIMES' ),
			/* translators: Logged-in trigger - LearnDash */
			'select_option_name'  => esc_attr__( 'A user completes {{a course}}', 'uncanny-automator' ),
			'action'              => 'learndash_course_completed',
			'priority'            => 20,
			'accepted_args'       => 1,
			'validation_function' => array( $this, 'course_done' ),
			'options'             => [

				Automator()->helpers->recipe->learndash->options->all_ld_courses(),
				Automator()->helpers->recipe->options->number_of_times(),
			],
		);

		Automator()->register->trigger( $trigger );

		return;
	}