UNCANNYCEUS_EARNSCEUS::define_trigger()

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


Source Source

File: src/integrations/uncanny-ceus/triggers/uncannyceus-earnsceus.php

	public function define_trigger() {

		$credit_designation_label_plural = get_option( 'credit_designation_label_plural', __( 'CEUs', 'uncanny-ceu' ) );


		$trigger = array(
			'author'              => Automator()->get_author_name( $this->trigger_code ),
			'support_link'        => Automator()->get_author_support_link( $this->trigger_code, 'integration/uncanny-continuing-education-credits-for-learndash/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			'meta'                => $this->trigger_meta,
			/* translators: Logged-in trigger - Uncanny CEUs. 1. Credit designation label (plural) */
			'sentence'            => sprintf( esc_attr__( 'The total number of %1$s earned by a user is greater than or equal to {{a specific number:%2$s}}', 'uncanny-automator' ), $credit_designation_label_plural, $this->trigger_meta ),
			/* translators: Logged-in trigger - Uncanny CEUs. 1. Credit designation label (plural) */
			'select_option_name'  => sprintf( esc_attr__( 'The total number of %1$s earned by a user is greater than or equal to {{a specific number}}', 'uncanny-automator' ), $credit_designation_label_plural ),
			'action'              => 'ceus_after_updated_user_ceu_record',
			'priority'            => 20,
			'accepted_args'       => 7,
			'validation_function' => array( $this, 'updated_user_ceu_record' ),
			'options'             => [
				[
					'option_code'     => $this->trigger_meta,
					/* translators: Uncanny CEUs. 1. Credit designation label (plural) */
					'label'           => sprintf( esc_attr__( 'Number of %1$s', 'uncanny-automator' ), $credit_designation_label_plural ),
					'input_type'      => 'int',
					'validation_type' => 'integer',
					'required'        => true,
				],
			],
		);

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

		return;
	}