Skip to content

Commit

Permalink
Hook up packages/jetpack-forms to plugins/jetpack (#28416)
Browse files Browse the repository at this point in the history
  • Loading branch information
ice9js authored Jan 18, 2023
1 parent d54d3f6 commit a0cc39c
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 1 deletion.
4 changes: 4 additions & 0 deletions projects/packages/forms/changelog/add-forms-dependency
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added a public load_contact_form method for initializing the contact form module.
5 changes: 5 additions & 0 deletions projects/packages/forms/src/class-jetpack-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ class Jetpack_Forms {

const PACKAGE_VERSION = '0.1.0-alpha';

/**
* Load the contact form module.
*/
public static function load_contact_form() {
}
}
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/add-forms-dependency
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Added the dependency on automattic/jetpack-forms
1 change: 1 addition & 0 deletions projects/plugins/jetpack/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"automattic/jetpack-constants": "@dev",
"automattic/jetpack-device-detection": "@dev",
"automattic/jetpack-error": "@dev",
"automattic/jetpack-forms": "@dev",
"automattic/jetpack-google-fonts-provider": "@dev",
"automattic/jetpack-identity-crisis": "@dev",
"automattic/jetpack-jitm": "@dev",
Expand Down
64 changes: 63 additions & 1 deletion projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions projects/plugins/jetpack/modules/contact-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @package automattic/jetpack
*/

use Automattic\Jetpack\Forms\Jetpack_Forms;

/**
* Module Name: Contact Form
* Module Description: Add a customizable contact form to any post or page using the Jetpack Form Block.
Expand All @@ -18,6 +20,21 @@
* 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
*/

/**
* Whether to load the newer Jetpack Forms package.
*
* @use add_filter( 'jetpack_contact_form_use_package', '__return_true' );
* @module contact-form
*
* @since $$next-version$$
*
* @param bool $load_contact_form_package Load Jetpack Forms package. Default to false.
*/
if ( apply_filters( 'jetpack_contact_form_use_package', false ) ) {
Jetpack_Forms::load_contact_form();
return true; // Not returning true will cause the module to become deactivated.
}

require_once __DIR__ . '/contact-form/grunion-contact-form.php';

/*
Expand Down

0 comments on commit a0cc39c

Please sign in to comment.