calypsoify
2 years ago
carousel
2 years ago
cloudflare-analytics
2 years ago
comment-likes
5 years ago
comments
2 years ago
custom-css
2 years ago
custom-post-types
2 years ago
geo-location
4 years ago
google-analytics
2 years ago
google-fonts
2 years ago
gravatar
6 years ago
infinite-scroll
2 years ago
likes
2 years ago
markdown
2 years ago
masterbar
2 years ago
memberships
2 years ago
photon-cdn
2 years ago
plugin-search
4 years ago
post-by-email
3 years ago
related-posts
2 years ago
scan
2 years ago
seo-tools
2 years ago
sharedaddy
2 years ago
shortcodes
2 years ago
simple-payments
3 years ago
site-icon
2 years ago
sitemaps
2 years ago
sso
2 years ago
stats
2 years ago
subscriptions
2 years ago
theme-tools
2 years ago
tiled-gallery
2 years ago
verification-tools
4 years ago
videopress
2 years ago
widget-visibility
2 years ago
widgets
2 years ago
woocommerce-analytics
2 years ago
wordads
2 years ago
wpcom-block-editor
2 years ago
wpcom-tos
5 years ago
blaze.php
2 years ago
carousel.php
2 years ago
comment-likes.php
2 years ago
comments.php
2 years ago
contact-form.php
2 years ago
copy-post.php
2 years ago
custom-content-types.php
4 years ago
custom-css.php
2 years ago
geo-location.php
4 years ago
google-analytics.php
2 years ago
google-fonts.php
2 years ago
gravatar-hovercards.php
2 years ago
infinite-scroll.php
3 years ago
json-api.php
5 years ago
latex.php
4 years ago
likes.php
2 years ago
markdown.php
4 years ago
masterbar.php
2 years ago
module-extras.php
2 years ago
module-headings.php
2 years ago
module-info.php
2 years ago
monitor.php
2 years ago
notes.php
2 years ago
photon-cdn.php
2 years ago
photon.php
3 years ago
plugin-search.php
2 years ago
post-by-email.php
5 years ago
post-list.php
4 years ago
protect.php
3 years ago
publicize.php
2 years ago
related-posts.php
2 years ago
search.php
4 years ago
seo-tools.php
2 years ago
sharedaddy.php
2 years ago
shortcodes.php
2 years ago
shortlinks.php
2 years ago
sitemaps.php
4 years ago
sso.php
2 years ago
stats.php
2 years ago
subscriptions.php
2 years ago
theme-tools.php
3 years ago
tiled-gallery.php
4 years ago
vaultpress.php
2 years ago
verification-tools.php
5 years ago
videopress.php
4 years ago
waf.php
3 years ago
widget-visibility.php
4 years ago
widgets.php
3 years ago
woocommerce-analytics.php
2 years ago
wordads.php
2 years ago
wpgroho.js
6 years ago
contact-form.php
130 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Contact form module. |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | use Automattic\Jetpack\Forms\Jetpack_Forms; |
| 9 | |
| 10 | /** |
| 11 | * Module Name: Contact Form |
| 12 | * Module Description: Add a customizable contact form to any post or page using the Jetpack Form Block. |
| 13 | * Sort Order: 15 |
| 14 | * Recommendation Order: 14 |
| 15 | * First Introduced: 1.3 |
| 16 | * Requires Connection: No |
| 17 | * Auto Activate: Yes |
| 18 | * Module Tags: Other |
| 19 | * Feature: Writing |
| 20 | * Additional Search Queries: contact, form, grunion, feedback, submission, contact form, email, feedback, contact form plugin, custom form, custom form plugin, form builder, forms, form maker, survey, contact by jetpack, contact us, forms free, creator |
| 21 | */ |
| 22 | |
| 23 | /** |
| 24 | * Load the newer Jetpack Forms package. |
| 25 | */ |
| 26 | Jetpack_Forms::load_contact_form(); |
| 27 | |
| 28 | /** |
| 29 | * Register Jetpack Form patterns |
| 30 | * |
| 31 | * @deprecated 13.4 Use Automattic\Jetpack\Forms\ContactForm\Util::register_pattern |
| 32 | */ |
| 33 | function jetpack_form_register_pattern() { |
| 34 | _deprecated_function( __METHOD__, 'jetpack-13.4', 'Automattic\Jetpack\Forms\ContactForm\Util::register_pattern' ); |
| 35 | $category_slug = 'forms'; |
| 36 | register_block_pattern_category( $category_slug, array( 'label' => __( 'Forms', 'jetpack' ) ) ); |
| 37 | |
| 38 | $patterns = array( |
| 39 | 'contact-form' => array( |
| 40 | 'title' => 'Contact Form', |
| 41 | 'blockTypes' => array( 'jetpack/contact-form' ), |
| 42 | 'categories' => array( $category_slug ), |
| 43 | 'content' => '<!-- wp:jetpack/contact-form {"style":{"spacing":{"padding":{"top":"16px","right":"16px","bottom":"16px","left":"16px"}}}} --> |
| 44 | <div class="wp-block-jetpack-contact-form" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px"> |
| 45 | <!-- wp:jetpack/field-name {"required":true} /--> |
| 46 | <!-- wp:jetpack/field-email {"required":true} /--> |
| 47 | <!-- wp:jetpack/field-textarea /--> |
| 48 | <!-- wp:jetpack/button {"element":"button","text":"Contact Us","lock":{"remove":true}} /--> |
| 49 | </div> |
| 50 | <!-- /wp:jetpack/contact-form -->', |
| 51 | ), |
| 52 | 'newsletter-form' => array( |
| 53 | 'title' => 'Newsletter Subscription Form', |
| 54 | 'blockTypes' => array( 'jetpack/contact-form' ), |
| 55 | 'categories' => array( $category_slug ), |
| 56 | 'content' => '<!-- wp:jetpack/contact-form {"style":{"spacing":{"padding":{"top":"16px","right":"16px","bottom":"16px","left":"16px"}}}} --> |
| 57 | <div class="wp-block-jetpack-contact-form" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px"> |
| 58 | <!-- wp:jetpack/field-name {"required":true} /--> |
| 59 | <!-- wp:jetpack/field-email {"required":true} /--> |
| 60 | <!-- wp:jetpack/field-consent /--> |
| 61 | <!-- wp:jetpack/button {"element":"button","text":"Subscribe","lock":{"remove":true}} /--> |
| 62 | </div> |
| 63 | <!-- /wp:jetpack/contact-form -->', |
| 64 | ), |
| 65 | 'rsvp-form' => array( |
| 66 | 'title' => 'RSVP Form', |
| 67 | 'blockTypes' => array( 'jetpack/contact-form' ), |
| 68 | 'categories' => array( $category_slug ), |
| 69 | 'content' => '<!-- wp:jetpack/contact-form {"subject":"A new RSVP from your website","style":{"spacing":{"padding":{"top":"16px","right":"16px","bottom":"16px","left":"16px"}}}} --> |
| 70 | <div class="wp-block-jetpack-contact-form" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px"> |
| 71 | <!-- wp:jetpack/field-name {"required":true} /--> |
| 72 | <!-- wp:jetpack/field-email {"required":true} /--> |
| 73 | <!-- wp:jetpack/field-radio {"label":"Attending?","required":true,"options":["Yes","No"]} /--> |
| 74 | <!-- wp:jetpack/field-textarea {"label":"Other Details"} /--> |
| 75 | <!-- wp:jetpack/button {"element":"button","text":"Send RSVP","lock":{"remove":true}} /--> |
| 76 | </div> |
| 77 | <!-- /wp:jetpack/contact-form -->', |
| 78 | ), |
| 79 | 'registration-form' => array( |
| 80 | 'title' => 'Registration Form', |
| 81 | 'blockTypes' => array( 'jetpack/contact-form' ), |
| 82 | 'categories' => array( $category_slug ), |
| 83 | 'content' => '<!-- wp:jetpack/contact-form {"subject":"A new registration from your website","style":{"spacing":{"padding":{"top":"16px","right":"16px","bottom":"16px","left":"16px"}}}} --> |
| 84 | <div class="wp-block-jetpack-contact-form" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px"> |
| 85 | <!-- wp:jetpack/field-name {"required":true} /--> |
| 86 | <!-- wp:jetpack/field-email {"required":true} /--> |
| 87 | <!-- wp:jetpack/field-telephone {"label":"Phone Number"} /--> |
| 88 | <!-- wp:jetpack/field-select {"label":"How did you hear about us?","options":["Search Engine","Social Media","TV","Radio","Friend or Family"]} /--> |
| 89 | <!-- wp:jetpack/field-textarea {"label":"Other Details"} /--> |
| 90 | <!-- wp:jetpack/button {"element":"button","text":"Send","lock":{"remove":true}} /--> |
| 91 | </div> |
| 92 | <!-- /wp:jetpack/contact-form -->', |
| 93 | ), |
| 94 | 'appointment-form' => array( |
| 95 | 'title' => 'Appointment Form', |
| 96 | 'blockTypes' => array( 'jetpack/contact-form' ), |
| 97 | 'categories' => array( $category_slug ), |
| 98 | 'content' => '<!-- wp:jetpack/contact-form {"subject":"A new appointment booked from your website","style":{"spacing":{"padding":{"top":"16px","right":"16px","bottom":"16px","left":"16px"}}}} --> |
| 99 | <div class="wp-block-jetpack-contact-form" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px"> |
| 100 | <!-- wp:jetpack/field-name {"required":true} /--> |
| 101 | <!-- wp:jetpack/field-email {"required":true} /--> |
| 102 | <!-- wp:jetpack/field-telephone {"required":true} /--> |
| 103 | <!-- wp:jetpack/field-date {"label":"Date","required":true} /--> |
| 104 | <!-- wp:jetpack/field-radio {"label":"Time","required":true,"options":["Morning","Afternoon"]} /--> |
| 105 | <!-- wp:jetpack/field-textarea {"label":"Notes"} /--> |
| 106 | <!-- wp:jetpack/button {"element":"button","text":"Book Appointment","lock":{"remove":true}} /--> |
| 107 | </div> |
| 108 | <!-- /wp:jetpack/contact-form -->', |
| 109 | ), |
| 110 | 'feedback-form' => array( |
| 111 | 'title' => 'Feedback Form', |
| 112 | 'blockTypes' => array( 'jetpack/contact-form' ), |
| 113 | 'categories' => array( $category_slug ), |
| 114 | 'content' => '<!-- wp:jetpack/contact-form {"subject":"New feedback received from your website","style":{"spacing":{"padding":{"top":"16px","right":"16px","bottom":"16px","left":"16px"}}}} --> |
| 115 | <div class="wp-block-jetpack-contact-form" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px"> |
| 116 | <!-- wp:jetpack/field-name {"required":true} /--> |
| 117 | <!-- wp:jetpack/field-email {"required":true} /--> |
| 118 | <!-- wp:jetpack/field-radio {"label":"Please rate our website","required":true,"options":["1 - Very Bad","2 - Poor","3 - Average","4 - Good","5 - Excellent"]} /--> |
| 119 | <!-- wp:jetpack/field-textarea {"label":"How could we improve?"} /--> |
| 120 | <!-- wp:jetpack/button {"element":"button","text":"Send Feedback","lock":{"remove":true}} /--> |
| 121 | </div> |
| 122 | <!-- /wp:jetpack/contact-form -->', |
| 123 | ), |
| 124 | ); |
| 125 | |
| 126 | foreach ( $patterns as $name => $pattern ) { |
| 127 | register_block_pattern( $name, $pattern ); |
| 128 | } |
| 129 | } |
| 130 |