WPSP_PURCHWITHFORM::define_trigger()

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


Source Source

File: src/integrations/wp-simple-pay/triggers/wpsp-purchwithform.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/wp-simple-pay/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - WP Job Manager */
			'sentence'            => sprintf( esc_attr__( 'A user completes a purchase with {{a form:%1$s}}',
				'uncanny-automator' ), $this->trigger_meta ),
			/* translators: Logged-in trigger - WP Job Manager */
			'select_option_name'  => esc_attr__( 'A user completes a purchase with {{a form}}',
				'uncanny-automator' ),
			'action'              => 'simpay_charge_created',
			'priority'            => 20,
			'accepted_args'       => 2,
			'validation_function' => array( $this, 'simple_pay_charge_created' ),
			'options'             => [
				Automator()->helpers->recipe->wp_simple_pay->options->list_wp_simpay_forms( null,
					$this->trigger_meta, [ 'is_any' => true ] ),
			],
		);

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