Formidable_Helpers::extract_save_fi_fields( $entry_id,  $form_id,  $args )


Parameters Parameters

$entry_id

(Required)

$form_id

(Required)

$args

(Required)


Top ↑

Return Return

(array)


Source Source

File: src/integrations/formidable/helpers/formidable-helpers.php

	public function extract_save_fi_fields( $entry_id, $form_id, $args ) {
		$data = array();
		if ( $entry_id && class_exists( '\FrmEntryMeta' ) ) {
			$metas          = FrmEntryMeta::get_entry_meta_info( $entry_id );
			$trigger_id     = (int) $args['trigger_id'];
			$user_id        = (int) $args['user_id'];
			$trigger_log_id = (int) $args['trigger_log_id'];
			$run_number     = (int) $args['run_number'];
			$meta_key       = (string) $args['meta_key'];

			foreach ( $metas as $meta ) {
				$field_id     = $meta->field_id;
				$key          = "{$trigger_id}:{$meta_key}:{$form_id}|{$field_id}";
				$data[ $key ] = $meta->meta_value;
			}

			if ( $data ) {

				$insert = [
					'user_id'        => $user_id,
					'trigger_id'     => $trigger_id,
					'trigger_log_id' => $trigger_log_id,
					'meta_key'       => $meta_key,
					'meta_value'     => maybe_serialize( $data ),
					'run_number'     => $run_number,
				];
				Automator()->insert_trigger_meta( $insert );
			}
		}

		return $data;
	}