Skip to content

Instantly share code, notes, and snippets.

@bappi-d-great
Last active June 4, 2020 09:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bappi-d-great/244b113ae9b86c94fbc7605cc3cdf391 to your computer and use it in GitHub Desktop.
Save bappi-d-great/244b113ae9b86c94fbc7605cc3cdf391 to your computer and use it in GitHub Desktop.
add_form
<?php
$wrappers = array(
array(
'wrapper_id' => 'wrapper-1511378776546-9087',
'fields' => array(
array(
'element_id' => 'name-1',
'type' => 'name',
'cols' => '12',
"required" => "true",
"field_label" => __( "First Name", Forminator::DOMAIN ),
"placeholder" => __( "E.g. John", Forminator::DOMAIN ),
"prefix_label" => __( "Prefix", Forminator::DOMAIN ),
"fname_label" => __( "First Name", Forminator::DOMAIN ),
"fname_placeholder" => __( "E.g. John", Forminator::DOMAIN ),
"mname_label" => __( "Middle Name", Forminator::DOMAIN ),
"mname_placeholder" => __( "E.g. Smith", Forminator::DOMAIN ),
"lname_label" => __( "Last Name", Forminator::DOMAIN ),
"lname_placeholder" => __( "E.g. Doe", Forminator::DOMAIN ),
),
),
),
array(
'wrapper_id' => 'wrapper-1511347712118-1739',
'fields' => array(
array(
'element_id' => 'email-1',
'type' => 'email',
'cols' => '12',
"required" => "true",
"field_label" => __( "Email Address", Forminator::DOMAIN ),
"placeholder" => __( "E.g. john@doe.com", Forminator::DOMAIN ),
"validation" => true,
"validation_text" => "",
),
),
),
array(
'wrapper_id' => 'wrapper-1311247712118-1194',
'fields' => array(
array(
'element_id' => 'phone-1',
'type' => 'phone',
'cols' => '12',
"required" => false,
"field_label" => __( "Phone Number", Forminator::DOMAIN ),
"placeholder" => __( "E.g. +1 3004005000", Forminator::DOMAIN ),
"validation" => true,
"validation_text" => "",
),
),
),
array(
'wrapper_id' => 'wrapper-1311247713309-1155',
'fields' => array(
array(
'element_id' => 'text-1',
'type' => 'text',
'cols' => '12',
"required" => false,
"field_label" => __( "Age", Forminator::DOMAIN ),
"placeholder" => __( "E.g. 12", Forminator::DOMAIN ),
"validation" => true,
"validation_text" => "",
),
),
)
);
$settings = array(
"formName" => 'API Test 2.0',
"thankyou" => "true",
"thankyou-message" => __( "Thank you for contacting us, we will be in touch shortly.", Forminator::DOMAIN ),
"use-custom-submit" => "true",
"custom-submit-text" => __( "Send Message", Forminator::DOMAIN ),
"use-custom-invalid-form" => "true",
"custom-invalid-form-message" => __( "Error: Your form is not valid, please fix the errors!", Forminator::DOMAIN )
);
Forminator_API::add_form(
'Form Test 3',
$wrappers,
$settings
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment