Populate_From_Query::add_trigger_value( $trigger_id )

Populates the POST array with the data and adds trigger value.


Parameters Parameters

$trigger_id

(Required)


Top ↑

Return Return

(bool)


Source Source

File: src/core/classes/class-populate-from-query.php

	public static function add_trigger_value( $trigger_id ) {

		$_POST['itemId']      = $trigger_id;
		$_POST['optionCode']  = $_GET['optionCode'];
		$_POST['optionValue'] = array(
			$_POST['optionCode']               => $_GET['optionValue'],
			$_POST['optionCode'] . '_readable' => urldecode( $_GET['optionValue_readable'] ),
		);

		$trigger_value_added = self::$recipe->update( '' );

		if ( ! $trigger_value_added->data['success'] ) {

			throw new \Exception( "Trigger value couldn't be set." );

		}

		return true;

	}