Automator_Get_Data::value_from_action_meta( null $action_code = null, null $meta = null )


Parameters Parameters

$action_code

(Optional)

Default value: null

$meta

(Optional)

Default value: null


Top ↑

Return Return

(mixed|string|null)


Source Source

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

	public function value_from_action_meta( $action_code = null, $meta = null ) {
		if ( null === $action_code || ! is_string( $action_code ) ) {
			Automator()->error->add_error( 'value_from_action_meta', 'ERROR: You are trying to get a action meta from an action code without providing an $action_code', $this );
			return null;
		}
		if ( null === $meta || ! is_string( $meta ) ) {
			Automator()->error->add_error( 'value_from_action_meta', 'ERROR: You are trying to get an action meta from an action code without providing a $meta', $this );
			return null;
		}
		// Load all default trigger settings
		$meta_value     = null;
		$system_actions = Automator()->get_actions();
		if ( empty( $system_actions ) ) {
			return $meta_value;
		}
		foreach ( $system_actions as $system_action ) {
			if ( $system_action['code'] === $action_code ) {
				return isset( $system_action[ $meta ] ) ? $system_action[ $meta ] : $meta_value;
			}
		}
		return $meta_value;
	}