Automator_Get_Data::closure_execution_function_from_closure_code( null $closure_code = null )

Accepts an action code(most like from trigger meta) and returns that associated action execution function


Parameters Parameters

$closure_code

(null) (Optional)

Default value: null


Top ↑

Return Return

(null) |array String is the public function is not within a class and array if it is


Source Source

File: src/core/lib/utilities/class-automator-get-data.php

	public function closure_execution_function_from_closure_code( $closure_code = null ) {

		if ( null === $closure_code || ! is_string( $closure_code ) ) {
			Automator()->error->add_error( 'closure_execution_function_from_closure_code', 'ERROR: You are trying to get an action execution function from an action code without providing a $action_code', $this );

			return null;
		}

		// Load all default trigger settings
		$system_closures = Automator()->get_closures();
		if ( empty( $system_closures ) ) {
			return null;
		}

		foreach ( $system_closures as $system_closure ) {
			if ( $system_closure['code'] === $closure_code ) {

				return $system_closure['execution_function'];
			}
		}

		return null;
	}