UOA_RECIPEERRORSTIMES::define_trigger()

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


Source Source

File: src/integrations/uncanny-automator/triggers/uoa-recipeerrorstimes.php

	public function define_trigger() {
		$trigger = array(
			'author'              => Automator()->get_author_name( $this->trigger_code ),
			'support_link'        => Automator()->get_author_support_link( $this->trigger_code, 'integration/automator-core/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			'type'                => 'anonymous',
			/* translators: Logged-in trigger - Uncanny Automator */
			'sentence'            => sprintf( esc_attr__( '{{A recipe:%1$s}} completes with errors {{a number of:%2$s}} time(s)', 'uncanny-automator' ), $this->trigger_meta, $this->num_times ),
			/* translators: Logged-in trigger - Uncanny Automator */
			'select_option_name'  => esc_attr__( '{{A recipe}} completes with errors {{a number of}} time(s)', 'uncanny-automator' ),
			'action'              => 'automator_recipe_completed_with_errors',
			'priority'            => 299,
			'accepted_args'       => 4,
			'validation_function' => array( $this, 'on_completion' ),
			'options'             => array(
				Automator()->helpers->recipe->uncanny_automator->options->get_recipes(),
				Automator()->helpers->recipe->field->int(
					array(
						'option_code' => $this->num_times,
						'label'       => esc_attr__( 'Number of times', 'uncanny-automator' ),
						'placeholder' => esc_attr__( 'Example: 1', 'uncanny-automator' ),
						'default'     => '1',
					)
				),
			),
		);
		Automator()->register->trigger( $trigger );
	}