Gf_Tokens::save_token_data( $args,  $trigger )


Parameters Parameters

$args

(Required)

$trigger

(Required)


Top ↑

Return Return

(void)


Source Source

File: src/integrations/gravity-forms/tokens/gf-tokens.php

	public function save_token_data( $args, $trigger ) {
		if ( ! isset( $args['trigger_args'] ) || ! isset( $args['entry_args']['code'] ) ) {
			return;
		}
		$triggers = array( 'GF_SUBFORM_CODES' );
		if ( in_array( $args['entry_args']['code'], $triggers, true ) ) {
			list( $entry, $form ) = $args['trigger_args'];
			$code_fields          = Gravity_Forms_Helpers::get_code_fields( $entry, $form );
			if ( ! empty( $code_fields ) ) {
				$code_field = array_shift( $code_fields );
				if ( ! empty( $code_field ) && null !== $code_field ) {
					$batch = Gravity_Forms_Helpers::get_batch_by_value( $code_field, $entry );
					Automator()->db->token->save( 'UCBATCH', absint( $batch->code_group ), $args['trigger_entry'] );
				}
			}
			Automator()->db->token->save( 'GFENTRYID', $entry['id'], $args['trigger_entry'] );
			Automator()->db->token->save( 'GFUSERIP', maybe_serialize( $entry['ip'] ), $args['trigger_entry'] );
			Automator()->db->token->save( 'GFENTRYDATE', maybe_serialize( \GFCommon::format_date( $entry['date_created'], false, 'Y/m/d' ) ), $args['trigger_entry'] );
			Automator()->db->token->save( 'GFENTRYSOURCEURL', maybe_serialize( $entry['source_url'] ), $args['trigger_entry'] );
		}
	}