Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Triggers::process_trigger( $args )

Everything has been sorted. Let’s go ahead and execute trigger.


Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Parameters Parameters

$args

(Required)


Source Source

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

	protected function process_trigger( $args ) {
		/**
		 * Allow developers to manipulate $pass_args with custom arguments. For example, ignore_post_id.
		 */
		$pass_args = $this->prepare_entry_args( $args );
		/**
		 * Should the trigger be autocompleted and continue running trigger?
		 */
		$complete_trigger = apply_filters( 'automator_auto_complete_trigger', $this->do_trigger_autocomplete(), $pass_args, $args );
		/**
		 * Attempt to add trigger entry and autocomplete it if autocomplete is set to true.
		 */
		do_action( 'automator_before_trigger_run', $args, $pass_args );
		if ( true === $this->do_trigger_autocomplete() ) {
			Automator()->process->user->maybe_add_trigger_entry( $pass_args, $complete_trigger );
		} else {
			$entry_args = Automator()->process->user->maybe_add_trigger_entry( $pass_args, $complete_trigger );
			/**
			 * If trigger is not autocompleted, an array is returned which should be handled manually.
			 */
			if ( empty( $entry_args ) ) {
				return;
			}
			foreach ( $entry_args as $result ) {
				if ( true === $result['result'] ) {
					$result_args = $result['args'];
					/**
					 * @var array $args | All the arguments passed to this function
					 * @var array $pass_args | All the arguments passed to run mark a trigger complete
					 * @var array $result_args | All the arguments returned after marking trigger complete
					 */
					$do_action = array(
						'trigger_entry' => $result_args,
						'entry_args'    => $pass_args,
						'trigger_args'  => $args,
					);
					do_action( 'automator_before_trigger_completed', $do_action, $this );
					Automator()->process->user->maybe_trigger_complete( $result_args );
					do_action( 'automator_after_trigger_completed', $do_action, $this );
				}
			}
		}
		do_action( 'automator_after_trigger_run', $args, $pass_args );
	}