MEC_USER_BOOKING_COMPLETED::define_trigger()

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


Return Return

(Uncanny_Automatorvoid.)


Source Source

File: src/integrations/modern-events-calendar/triggers/mec-user-booking-completed.php

	public function define_trigger() {



		$helper = new MEC_HELPERS();

		$events_options = $helper->get_events_select_field(
			array(
				'option_code'     => $this->trigger_code,
				'fill_values_in'  => '',
				'is_ajax'         => false,
				'description'     => esc_html__( 'Select from the list of available Events. Select `Any Event` if you wish to run this Trigger for all Events.', 'uncanny-automator' ),
				'relevant_tokens' => array(
					$this->token . 'EVENT_DATE'      => esc_html__( 'Event Date', 'uncanny-automator' ),
					$this->token . 'EVENT_TIME'      => esc_html__( 'Event Time', 'uncanny-automator' ),
					$this->token . 'EVENT_LOCATION'  => esc_html__( 'Event Location', 'uncanny-automator' ),
					$this->token . 'EVENT_ORGANIZER' => esc_html__( 'Event Organizer', 'uncanny-automator' ),
					$this->token . 'EVENT_COST'      => esc_html__( 'Event Cost', 'uncanny-automator' ),
				),
			)
		);

		$events_options['options'] = array( '-1' => sprintf( 'Any Event', 'uncanny-automator' ) ) + $events_options['options'];

		$trigger = array(
			'author'              => Automator()->get_author_name(),
			'support_link'        => Automator()->get_author_support_link(),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			'is_pro'              => false,
			'sentence'            => sprintf(
				/* translators: ‘ is an HTML character for single qoute. %1$s The Event or `Any Event` */
				esc_attr__( 'A user‘s booking of {{an event:%1$s}} is completed', 'uncanny-automator' ),
				$this->trigger_code
			),
			'select_option_name'  => esc_attr__( "A user's booking of {{an event}} is completed", 'uncanny-automator' ),
			'action'              => 'mec_booking_completed', //mec_booking_completed
			'priority'            => 99,
			'accepted_args'       => 1,
			'validation_function' => array( $this, 'mec_booking_completed' ),
			'options'             => array(
				$events_options,
			),
		);

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

	}