Skip to content

Instantly share code, notes, and snippets.

@Shelob9 Shelob9/composer.json
Last active Apr 13, 2019

Embed
What would you like to do?
{
"name": "shelob9/contact-form",
"license": "GPL-2.0",
"type": "wordpress-muplugin"
}
<?php
/**
* Change entry to active status before responding
*/
add_action( 'calderaForms/restApi/createEntry/complete', function( \Caldera_Forms_Entry $entry){
$entry->update_status( 'active' );
});
/**
* Hooks to load form.
* Remove "caldera_forms_admin_forms" if you do not want this form to show in admin entry viewer
*/
add_filter("caldera_forms_get_forms", "slug_register_caldera_forms_contactformgatsby");
add_filter("caldera_forms_admin_forms", "slug_register_caldera_forms_contactformgatsby");
/**
* Add form to front-end and admin
*
* @param array $forms All registered forms
*
* @return array
*/
function slug_register_caldera_forms_contactformgatsby($forms)
{
$forms[ "contact" ] = apply_filters("caldera_forms_get_form-contact", []);
return $forms;
}
;
/**
* Filter form request to include form structure to be rendered
**
* @param $form array form structure
*/
add_filter('caldera_forms_get_form-contact', function ($form) {
return [
'_last_updated' => 'Fri, 12 Apr 2019 23:31:47 +0000',
'ID' => 'contact',
'cf_version' => '1.9.0-a.1',
'name' => 'Contact Form Gatsby',
'scroll_top' => 0,
'success' => 'Form has been successfully submitted. Thank you. ',
'db_support' => 1,
'pinned' => 1,
'hide_form' => 1,
'avatar_field' => 'email',
'form_ajax' => 1,
'custom_callback' => '',
'layout_grid' =>
[
'fields' =>
[
'name' => '1:1',
'email' => '1:2',
'comments_questions' => '2:1',
'submit' => '3:1',
],
'structure' => '6:6|12|12',
],
'fields' =>
[
'name' =>
[
'ID' => 'name',
'type' => 'text',
'label' => 'Name',
'slug' => 'name',
'conditions' =>
[
'type' => '',
],
'required' => 1,
'caption' => '',
'config' =>
[
'custom_class' => '',
'placeholder' => '',
'default' => '',
'type_override' => 'text',
'mask' => '',
'email_identifier' => 0,
'personally_identifying' => 0,
],
],
'email' =>
[
'ID' => 'email',
'type' => 'email',
'label' => 'Email Address',
'slug' => 'email',
'conditions' =>
[
'type' => '',
],
'required' => 1,
'caption' => '',
'config' =>
[
'custom_class' => '',
'placeholder' => '',
'default' => '',
'email_identifier' => 0,
'personally_identifying' => 0,
],
],
'comments_questions' =>
[
'ID' => 'comments_questions',
'type' => 'paragraph',
'label' => 'Comments / Questions',
'slug' => 'comments_questions',
'conditions' =>
[
'type' => '',
],
'caption' => '',
'config' =>
[
'custom_class' => '',
'placeholder' => '',
'rows' => 7,
'default' => '',
'email_identifier' => 0,
'personally_identifying' => 0,
],
],
'submit' =>
[
'ID' => 'submit',
'type' => 'button',
'label' => 'Send Message',
'slug' => 'submit',
'conditions' =>
[
'type' => '',
],
'caption' => '',
'config' =>
[
'custom_class' => '',
'type' => 'submit',
'class' => 'btn btn-default',
'target' => '',
],
],
],
'page_names' =>
[
0 => 'Page 1',
],
'mailer' =>
[
'on_insert' => 1,
'sender_name' => 'Josh',
'sender_email' => '%email%',
'reply_to' => '%email_address%',
'email_type' => 'html',
'recipients' => 'josh@joshpress.net',
'bcc_to' => '',
'email_subject' => 'Contact Form Gatsby Site',
'email_message' => '{summary}',
],
'check_honey' => 1,
'antispam' =>
[
'sender_name' => '',
'sender_email' => '',
],
'conditional_groups' =>
[
],
'settings' =>
[
'responsive' =>
[
'break_point' => 'sm',
],
],
'privacy_exporter_enabled' => false,
'version' => '1.9.0-a.1',
'db_id' => '128',
'type' => 'primary',
'_external_form' => 1,
];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.