EM_REGISTER::define_trigger()

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


Source Source

File: src/integrations/events-manager/triggers/em-register.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/events-manager/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - The Events Manager */
			'sentence'            => sprintf( __( 'A user registers for {{an event:%1$s}}', 'uncanny-automator' ), $this->trigger_meta ),
			/* translators: Logged-in trigger - The Events Manager */
			'select_option_name'  => __( 'A user registers for {{an event}}', 'uncanny-automator-pro' ),
			'action'              => 'em_booking_set_status',
			'priority'            => 99,
			'accepted_args'       => 2,
			'validation_function' => array( $this, 'user_registered_for_event' ),
			'options'             => [
				Automator()->helpers->recipe->events_manager->options->all_em_events(
					__( 'Event', 'uncanny-automator-pro' ),
					$this->trigger_meta,
					[ 'any_option' => true ] ),
			],
		);

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

		return;
	}