FR_SUBMITFORM::fr_submit_form( $entry, int $form_id,  $field_data_array )

Validation function when the trigger action is hit


Parameters Parameters

$form_id

(int) (Required) submitted form id.

$response

(array) (Required) response array.

$method

(Required)


Source Source

File: src/integrations/forminator/triggers/fr-submitform.php

	public function fr_submit_form( $form_id, $response, $method ) {
		if ( true === $response['success'] ) {


			$user_id = get_current_user_id();
			if ( empty( $user_id ) ) {
				return;
			}

			$args = [
				'code'    => $this->trigger_code,
				'meta'    => $this->trigger_meta,
				'post_id' => intval( $form_id ),
				'user_id' => intval( $user_id ),
			];

			$args = Automator()->maybe_add_trigger_entry( $args, false );

			//Adding an action to save contact form submission in trigger meta
			$recipes = Automator()->get->recipes_from_trigger_code( $this->trigger_code );
			do_action( 'automator_save_forminator_form_entry', $form_id, $recipes, $args );

			if ( $args ) {
				foreach ( $args as $result ) {
					if ( true === $result['result'] ) {
						Automator()->maybe_trigger_complete( $result['args'] );
					}
				}
			}
		}
	}