Skip to content

Commit

Permalink
Feature - WPBakery Builder Compatibility (#1350)
Browse files Browse the repository at this point in the history
* 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
riteelama and MILAN88888 authored Nov 14, 2024
1 parent 29a9f51 commit 9280ba0
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 9 deletions.
11 changes: 6 additions & 5 deletions addons/Addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use EverestForms\Addons\OxygenBuilder\OxygenBuilder;
use EverestForms\Addons\DiviBuilder\DiviBuilder;
use EverestForms\Addons\BeaverBuilder\BeaverBuilder;
use EverestForms\Addons\WPBakeryBuilder\WPBakeryBuilder;
use EverestForms\Traits\Singleton;

/**
Expand Down Expand Up @@ -47,10 +48,11 @@ public function get_addon_list() {
return apply_filters(
'everest_forms_addon_list',
array(
'oxygen-builder' => OxygenBuilder::class,
'bricks-builder' => BricksBuilder::class,
'divi-builder' => DiviBuilder::class,
'beaver-builder' => BeaverBuilder::class,
'oxygen-builder' => OxygenBuilder::class,
'bricks-builder' => BricksBuilder::class,
'divi-builder' => DiviBuilder::class,
'beaver-builder' => BeaverBuilder::class,
'wpbakery-builder' => WPBakeryBuilder::class,
)
);
}
Expand All @@ -77,7 +79,6 @@ public function addons_init() {
foreach ( $classes as $key => $class_name ) {
$key = 'everest-forms-' . $key;
if ( in_array( $key, $enabled_features, true ) ) {

if ( class_exists( $class_name ) ) {
$class_name::init();
}
Expand Down
64 changes: 64 additions & 0 deletions addons/WPBakeryBuilder/Helper.php
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;
}
}
84 changes: 84 additions & 0 deletions addons/WPBakeryBuilder/WPBakeryBuilder.php
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' );
}
}
10 changes: 10 additions & 0 deletions assets/css/everest-forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
clear: both;
}

i.icon-wpb-vc_everest_forms {
background-image: url('data:image/svg+xml,%3Csvg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="32" height="32" rx="4" fill="%237545BB"/%3E%3Cpath d="M24.6621 4.62549H19.1523L20.8408 7.46923H26.3506L24.6621 4.62549Z" fill="white"/%3E%3Cpath d="M28.127 10.313H22.6172L24.3945 13.1567H29.9043L28.127 10.313Z" fill="white"/%3E%3Cpath d="M28.0381 24.5318H27.2383H24.7501H7.06544L15.8633 10.1353L19.5069 16.0005H18.7071H15.8633L14.1748 18.8443H15.8633H17.0186H24.5723L15.8633 4.80322L2 27.3755H4.48828H27.2383H29.8155L28.0381 24.5318Z" fill="white"/%3E%3C/svg%3E') !important;
background-repeat: no-repeat;
background-position: center;
background-size: 100%;
width: 32px;
height: 32px;

}

/**
* Main EverestForms styles
*/
Expand Down
32 changes: 32 additions & 0 deletions assets/extensions-json/sections/all_extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,22 @@
"setting_url": "",
"demo_video_url": ""
},
{
"title": "Bricks Builder",
"slug": "everest-forms-bricks-builder",
"name": "Everest Forms Bricks Builder",
"image": "extensions-json/sections/images/bricks-builder.png",
"excerpt": "Using Bricks Builder’s page editor, add your forms from Everest Forms to your website and customize them as needed.",
"link": "https://docs.everestforms.net/docs/bricks-builder/?utm_source=dashboard-all-feature&utm_medium=card-documentation-link",
"released_date": "xx/xx/xxxx",
"plan": [
"personal",
"agency",
"themegrill agency"
],
"setting_url": "",
"demo_video_url": ""
},
{
"title": "Slack",
"slug": "everest-forms-slack",
Expand Down Expand Up @@ -1016,6 +1032,22 @@
"setting_url": "",
"demo_video_url": "GSYQIiyntW0",
"popular_rank": 24
},
{
"title": "WP Bakery Builder",
"slug": "everest-forms-wpbakery-builder",
"name": "Everest Forms WP Bakery Builder",
"image": "extensions-json/sections/images/wpbakery.png",
"excerpt": "Using WPBakery’s page editor, add your forms from Everest Forms to your website and customize them as needed. ",
"link": "https://docs.everestforms.net/docs/wp-bakery-builder/?utm_source=dashboard-all-feature&utm_medium=card-documentation-link",
"released_date": "xx/xx/xxxx",
"plan": [
"personal",
"agency",
"themegrill agency"
],
"setting_url": "",
"demo_video_url": ""
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/images/icons/Everest-forms-verticalLogolight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Feature - Divi Builder Compatibility.
* Feature - Oxygen builder integration.
* Feature - Beaver Builder Compatibility.
* Feature - WPBakery Builder Compatibility.
* Tweak - Coupon into module.
* Tweak - Move active campaign to module.
* Tweak - Track module activation in TG User Tracking.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static function get_modules() {
$feature->link = $feature->link . '&utm_campaign=' . EVF()->utm_campaign;
$feature->type = 'feature';
$features_lists[ $key ] = $feature;
if ( in_array( $feature->slug, array( 'everest-forms-oxygen-builder', 'everest-forms-bricks-builder', 'everest-forms-divi-builder', 'everest-forms-beaver-builder' ), true ) ) {
if ( in_array( $feature->slug, array( 'everest-forms-oxygen-builder', 'everest-forms-bricks-builder', 'everest-forms-divi-builder', 'everest-forms-beaver-builder', 'everest-forms-wpbakery-builder' ), true ) ) {
$feature->required_plan = esc_html__( 'Free', 'everest-forms' );
}
}
Expand Down
9 changes: 6 additions & 3 deletions includes/shortcodes/class-evf-shortcode-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,17 +844,20 @@ public static function output( $atts ) {
wp_enqueue_script( 'everest-forms-survey-polls-quiz-script' );

// Load jQuery flatpickr libraries. https://github.com/flatpickr/flatpickr.
if ( evf_is_field_exists( $atts['id'], 'date-time' ) ) {
if ( isset( $atts['id'] ) && evf_is_field_exists( $atts['id'], 'date-time' ) ) {
wp_enqueue_style( 'flatpickr' );
wp_enqueue_script( 'flatpickr' );
}

// Load jQuery mailcheck library - https://github.com/mailcheck/mailcheck.
if ( evf_is_field_exists( $atts['id'], 'email' ) && (bool) apply_filters( 'everest_forms_mailcheck_enabled', true ) ) {
if ( isset( $atts['id'] ) && evf_is_field_exists( $atts['id'], 'email' ) && (bool) apply_filters( 'everest_forms_mailcheck_enabled', true ) ) {
wp_enqueue_script( 'mailcheck' );
}

self::add_custom_css_js( $atts['id'] );
// Add custom CSS/JS
if ( isset( $atts['id'] ) ) {
self::add_custom_css_js( $atts['id'] );
}

$atts = shortcode_atts(
array(
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ Yes you can! Join in on our [GitHub repository](https://github.com/wpeverest/eve
* Feature - Divi Builder Compatibility.
* Feature - Oxygen builder integration.
* Feature - Beaver Builder Compatibility.
* Feature - WPBakery Builder Compatibility.
* Tweak - Coupon into module.
* Tweak - Move active campaign to module.
* Tweak - Track module activation in TG User Tracking.
Expand Down
1 change: 1 addition & 0 deletions src/dashboard/Constants/Products.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,5 @@ export const FreeModules = [
'everest-forms-beaver-builder',
'everest-forms-bricks-builder',
'everest-forms-divi-builder',
'everest-forms-wpbakery-builder'
]

0 comments on commit 9280ba0

Please sign in to comment.