Trigger_Setup::register_trigger()

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


Source Source

File: src/core/lib/recipe-parts/triggers/trait-trigger-setup.php

	protected function register_trigger() {

		$trigger = array(
			'author'              => $this->get_author(),
			'support_link'        => $this->get_support_link(),
			'is_pro'              => $this->get_is_pro(),
			'is_deprecated'       => $this->get_is_deprecated(),
			'integration'         => $this->get_integration(),
			'code'                => $this->get_code(),
			'sentence'            => $this->get_sentence(),
			'select_option_name'  => $this->get_readable_sentence(),
			'action'              => $this->get_action(),
			'priority'            => $this->get_action_priority(),
			'accepted_args'       => $this->get_action_args_count(),
			'tokens'              => $this->get_trigger_tokens(),
			'token_parser'        => $this->get_token_parser(),
			'validation_function' => array( $this, 'validate' ),
		);

		if ( ! empty( $this->get_options() ) ) {
			$trigger['options'] = $this->get_options();
		}

		if ( ! empty( $this->get_options_group() ) ) {
			$trigger['options_group'] = $this->get_options_group();
		}

		$trigger = apply_filters( 'automator_register_trigger', $trigger );

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