-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature - WPBakery Builder Compatibility (#1350)
* Add - Basic setup for the oxygen builder * Add - Everest Forms element into the WP Bakery component list * Add - Displays the form in the builder using WP Bakery * Add - Image for wp bakery module * Add -Validation message for the WPBakery plugin activation * Tweak - WPbakery into free plan from the pro * Update - Wpbakery excerpt * Update - Changelog --------- Co-authored-by: MILAN88888 <chaudharymilan996@gmail.com>
- Loading branch information
1 parent
29a9f51
commit 9280ba0
Showing
12 changed files
with
212 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* WPBakery Integration helper functions. | ||
* | ||
* @since 3.0.5 | ||
* @package EverestForms\Addons\WPBakeryBuilder | ||
*/ | ||
|
||
namespace EverestForms\Addons\WPBakeryBuilder; | ||
|
||
/** | ||
* WPBakery Integration helper functions. | ||
* | ||
* @package EverestForms\Addons\WPBakeryBuilder | ||
* | ||
* @since 3.0.5 | ||
*/ | ||
class Helper { | ||
|
||
/** | ||
* Return if WPBakery is active. | ||
* | ||
* @since 3.0.5 | ||
* | ||
* @return boolean | ||
*/ | ||
public static function is_wpbakery_active() { | ||
return in_array( 'js_composer/js_composer.php', get_option( 'active_plugins', array() ), true ); | ||
} | ||
|
||
/** | ||
* Check if the current request is for WPBakery editor. | ||
* | ||
* @since 3.0.5 | ||
* | ||
* @return boolean | ||
*/ | ||
public static function is_WPBakery_editor() { | ||
return isset( $_REQUEST['action'] ) && | ||
( in_array( $_REQUEST['action'], array( 'vc_load_shortcode', 'vc_inline', 'vc_frontend_editor' ), true ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
} | ||
|
||
/** | ||
* Notice if the WPBakery is not instaled. | ||
* | ||
* @since 3.0.5 | ||
*/ | ||
public static function print_admin_notice() { | ||
|
||
add_action( | ||
'admin_notices', | ||
function () { | ||
printf( | ||
'<div class="notice notice-warning is-dismissible"><p><strong>%s </strong>%s</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">%s</span></button></div>', | ||
esc_html( 'Everest Forms:' ), | ||
wp_kses_post( 'WPBakery Integration addon requires WPBakery to be installed and activated.', 'everest-forms' ), | ||
esc_html__( 'Dismiss this notice.', 'everest-forms' ) | ||
); | ||
} | ||
); | ||
|
||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/** | ||
* Oxygen builder integration. | ||
* | ||
* @since 3.0.5 | ||
* @package EverestForms\Addons\WPBakeryBuilder\WPBakeryBuilder | ||
*/ | ||
namespace EverestForms\Addons\WPBakeryBuilder; | ||
|
||
use EverestForms\Traits\Singleton; | ||
use EverestForms\Addons\WPBakeryBuilder\Helper; | ||
|
||
/** | ||
* WPBakeryBuilder. | ||
* | ||
* @since 3.0.5 | ||
*/ | ||
class WPBakeryBuilder { | ||
|
||
use Singleton; | ||
|
||
public function __construct() { | ||
$this->setup(); | ||
} | ||
|
||
/** | ||
* Init. | ||
* | ||
* @since 3.0.5 | ||
*/ | ||
public function setup() { | ||
|
||
if ( ! Helper::is_wpbakery_active() ) { | ||
|
||
Helper::print_admin_notice(); | ||
|
||
return; | ||
} | ||
|
||
/** | ||
* Action to create WPBakery Widget for Everest Forms. | ||
* | ||
* @since 3.0.5 | ||
*/ | ||
add_action( 'vc_before_init', array( $this, 'evf_create_wpbakery_widget_category' ) ); | ||
} | ||
|
||
/** | ||
* Create WPBakery Widgets for Everest Forms. | ||
* | ||
* @since 3.0.5 | ||
*/ | ||
public function evf_create_wpbakery_widget_category() { | ||
$evf_get_all_forms = evf_get_all_forms(); | ||
$evf_all_forms = array_flip( $evf_get_all_forms ); | ||
|
||
if ( empty( $evf_all_forms ) ) { | ||
$evf_all_forms = array( '0' => esc_html__( 'Please create a form to use.', 'everest-forms' ) ); | ||
} else { | ||
$evf_all_forms = array_merge( array( 0 => esc_html__( 'Select Form', 'everest-forms' ) ), $evf_all_forms ); | ||
} | ||
|
||
vc_map( | ||
array( | ||
'name' => esc_html__( 'Everest Forms', 'everest-forms' ), | ||
'base' => 'everest_form', | ||
'icon' => 'icon-wpb-vc_everest_forms', | ||
'category' => esc_html__( 'Everest Forms', 'everest-forms' ), | ||
'description' => esc_html__( 'Everest Forms widget for WPBakery.', 'everest-forms' ), | ||
'params' => array( | ||
array( | ||
'type' => 'dropdown', | ||
'heading' => esc_html__( 'Form', 'everest-forms' ), | ||
'param_name' => 'id', | ||
'value' => $evf_all_forms, | ||
'description' => esc_html__( 'Select Form.', 'everest-forms' ), | ||
), | ||
), | ||
) | ||
); | ||
|
||
do_action( 'everest_forms_add_wpbakery_widget' ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters