| @@ -4,13 +4,17 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package automattic/jetpack |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | + exit( 0 ); | |
| 10 | +} | |
| 11 | + | |
| 8 | 12 | use Automattic\Jetpack\Forms\Jetpack_Forms; |
| 9 | 13 | |
| 10 | 14 | /** |
| 11 | - * Module Name: Contact Form | |
| 12 | - * Module Description: Add a customizable contact form to any post or page using the Jetpack Form Block. | |
| 15 | + * Module Name: Forms | |
| 16 | + * Module Description: Add contact, registration, and feedback forms directly from the block editor. | |
| 13 | 17 | * Sort Order: 15 |
| 14 | 18 | * Recommendation Order: 14 |
| 15 | 19 | * First Introduced: 1.3 |
| 16 | 20 | * Requires Connection: No |
| @@ -23,107 +27,4 @@ | ||
| 23 | 27 | /** |
| 24 | 28 | * Load the newer Jetpack Forms package. |
| 25 | 29 | */ |
| 26 | 30 | 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 | -} | |