Happy Addons for Elementor (Mega Menu, Post Grid, Woocommerce Product Grid, Table, Event Calendar, Slider Elementor Widget) - Version 2.3.0

Version Description

  • 20 November 2019 =

  • New: Gravity Forms Widget

  • New: Column Order control

  • New: Custom Column Width control

  • New: weForms section break styles

  • Fix: weForms misc style issues

Download this release

Release Info

Developer thehappymonster
Plugin Icon 128x128 Happy Addons for Elementor (Mega Menu, Post Grid, Woocommerce Product Grid, Table, Event Calendar, Slider Elementor Widget)
Version 2.3.0
Comparing to
See all releases

Code changes from version 2.2.6 to 2.3.0

assets/imgs/bf-img.png ADDED
Binary file
base.php CHANGED
@@ -54,6 +54,7 @@ class Base {
54
  if ( is_admin() ) {
55
  Updater::init();
56
  Dashboard::init();
 
57
  }
58
 
59
  do_action( 'happyaddons_loaded' );
@@ -66,7 +67,7 @@ class Base {
66
  */
67
  protected function init_appsero_tracking() {
68
  if ( ! class_exists( 'Happy_Addons\Appsero\Client' ) ) {
69
- require_once HAPPY_ADDONS_DIR_PATH . 'vendor/appsero/src/Client.php';
70
  }
71
 
72
  $this->appsero = new \Happy_Addons\Appsero\Client(
@@ -85,24 +86,25 @@ class Base {
85
  }
86
 
87
  public function include_files() {
88
- require( HAPPY_ADDONS_DIR_PATH . 'inc/functions-forms.php' );
89
- require( HAPPY_ADDONS_DIR_PATH . 'classes/icons-manager.php' );
90
- require( HAPPY_ADDONS_DIR_PATH . 'classes/widgets-manager.php' );
91
- require( HAPPY_ADDONS_DIR_PATH . 'classes/assets-manager.php' );
92
- require( HAPPY_ADDONS_DIR_PATH . 'classes/extensions-manager.php' );
93
- require( HAPPY_ADDONS_DIR_PATH . 'classes/cache-manager.php' );
94
 
95
- require( HAPPY_ADDONS_DIR_PATH . 'classes/widgets-cache.php' );
96
- require( HAPPY_ADDONS_DIR_PATH . 'classes/assets-cache.php' );
97
 
98
  if ( is_admin() ) {
99
- require( HAPPY_ADDONS_DIR_PATH . 'classes/class.communicator.php' );
100
- require( HAPPY_ADDONS_DIR_PATH . 'classes/updater.php' );
101
- require( HAPPY_ADDONS_DIR_PATH . 'classes/dashboard.php' );
 
102
  }
103
 
104
  if ( is_user_logged_in() ) {
105
- require( HAPPY_ADDONS_DIR_PATH . 'classes/admin-bar.php' );
106
  }
107
  }
108
 
@@ -131,9 +133,9 @@ class Base {
131
  * @access public
132
  */
133
  public function register_controls() {
134
- require( HAPPY_ADDONS_DIR_PATH . 'controls/foreground.php' );
135
  $foreground = __NAMESPACE__ . '\Controls\Group_Control_Foreground';
136
 
137
- \Elementor\Plugin::instance()->controls_manager->add_group_control( $foreground::get_type(), new $foreground() );
138
  }
139
  }
54
  if ( is_admin() ) {
55
  Updater::init();
56
  Dashboard::init();
57
+ Attention_Seeker::init();
58
  }
59
 
60
  do_action( 'happyaddons_loaded' );
67
  */
68
  protected function init_appsero_tracking() {
69
  if ( ! class_exists( 'Happy_Addons\Appsero\Client' ) ) {
70
+ include_once HAPPY_ADDONS_DIR_PATH . 'vendor/appsero/src/Client.php';
71
  }
72
 
73
  $this->appsero = new \Happy_Addons\Appsero\Client(
86
  }
87
 
88
  public function include_files() {
89
+ include( HAPPY_ADDONS_DIR_PATH . 'inc/functions-forms.php' );
90
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/icons-manager.php' );
91
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/widgets-manager.php' );
92
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/assets-manager.php' );
93
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/extensions-manager.php' );
94
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/cache-manager.php' );
95
 
96
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/widgets-cache.php' );
97
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/assets-cache.php' );
98
 
99
  if ( is_admin() ) {
100
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/class.communicator.php' );
101
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/updater.php' );
102
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/dashboard.php' );
103
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/attention-seeker.php' );
104
  }
105
 
106
  if ( is_user_logged_in() ) {
107
+ include( HAPPY_ADDONS_DIR_PATH . 'classes/admin-bar.php' );
108
  }
109
  }
110
 
133
  * @access public
134
  */
135
  public function register_controls() {
136
+ include_once( HAPPY_ADDONS_DIR_PATH . 'controls/foreground.php' );
137
  $foreground = __NAMESPACE__ . '\Controls\Group_Control_Foreground';
138
 
139
+ ha_elementor()->controls_manager->add_group_control( $foreground::get_type(), new $foreground() );
140
  }
141
  }
changelog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  = 2.2.6 - 11 November 2019 =
2
 
3
  - Fix: Conflict with Essential Addons causing PHP fatal error
1
+ = 2.3.0 - 20 November 2019 =
2
+
3
+ - New: Gravity Forms Widget
4
+ - New: Column Order control
5
+ - New: Custom Column Width control
6
+ - New: weForms section break styles
7
+ - Fix: weForms misc style issues
8
+
9
  = 2.2.6 - 11 November 2019 =
10
 
11
  - Fix: Conflict with Essential Addons causing PHP fatal error
classes/attention-seeker.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Show something awesome!
4
+ *
5
+ * @since 2.3.0
6
+ */
7
+ namespace Happy_Addons\Elementor;
8
+
9
+ defined( 'ABSPATH' ) || die();
10
+
11
+ class Attention_Seeker {
12
+
13
+ public static function init() {
14
+ add_action( 'admin_notices', [ __CLASS__, 'seek_attention' ] );
15
+ add_action( 'wp_ajax_ignore_attention_seeker', [ __CLASS__, 'process_ignore_request' ] );
16
+ add_action( 'admin_head', [ __CLASS__, 'setup_environment' ] );
17
+ }
18
+
19
+ public static function setup_environment() {
20
+ ?>
21
+ <script>
22
+ jQuery(function($) {
23
+ var $seeker = $('.ha-seeker'),
24
+ ajaxUrl = '<?php echo admin_url( 'admin-ajax.php' ); ?>',
25
+ nonce = '<?php echo wp_create_nonce( 'ignore_attention_seeker' ); ?>';
26
+
27
+ $seeker.on('click.onSeekerIgnore', '.notice-dismiss', function (e) {
28
+ e.preventDefault();
29
+ var $seeker = $(e.delegateTarget);
30
+
31
+ $.post(
32
+ ajaxUrl,
33
+ {
34
+ action: 'ignore_attention_seeker',
35
+ nonce: nonce,
36
+ id: $seeker.data('id')
37
+ },
38
+ function(res) {
39
+ if (res.success) {
40
+ console.log('Thanks! We will bring more awesome offer next time 🙂')
41
+ }
42
+ }
43
+ )
44
+ });
45
+ });
46
+ </script>
47
+ <?php
48
+ }
49
+
50
+ public static function process_ignore_request() {
51
+ $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
52
+ $id = isset( $_POST['id'] ) ? $_POST['id'] : '';
53
+
54
+ if ( wp_verify_nonce( $nonce, 'ignore_attention_seeker' ) && $id ) {
55
+ $seeker = wp_list_filter( self::get_attentions(), ['_id' => $id] );
56
+ $expire_date = $seeker[0]['end_date'];
57
+ set_transient( self::generate_db_key( $id ), 'ignore', intval( $expire_date ) );
58
+ wp_send_json_success();
59
+ }
60
+
61
+ exit;
62
+ }
63
+
64
+ private static function should_try( $attention ) {
65
+ if ( ha_has_pro() ) {
66
+ return false;
67
+ }
68
+
69
+ if ( ! isset( $attention['_id'], $attention['start_date'], $attention['end_date'], $attention['render_cb'] ) ) {
70
+ return false;
71
+ }
72
+
73
+ if ( ! is_callable( $attention['render_cb'] ) ) {
74
+ return false;
75
+ }
76
+
77
+ if ( get_transient( self::generate_db_key( $attention['_id'] ) ) === 'ignore' ) {
78
+ return false;
79
+ }
80
+
81
+ if ( time() >= $attention['start_date'] && time() <= $attention['end_date'] ) {
82
+ return true;
83
+ }
84
+
85
+ return false;
86
+ }
87
+
88
+ private static function generate_db_key( $id ) {
89
+ return 'ha-seeker-' . substr( md5( $id ), 0, 7 );
90
+ }
91
+
92
+ public static function seek_attention() {
93
+ foreach ( self::get_attentions() as $attention ) {
94
+ if ( self::should_try( $attention ) ) {
95
+ call_user_func( $attention['render_cb'], $attention['_id'] );
96
+ }
97
+ }
98
+ }
99
+
100
+ private static function get_attentions() {
101
+ return [
102
+ [
103
+ '_id' => '#000Friday',
104
+ 'start_date' => strtotime( '20th November 2019, 12AM' ),
105
+ 'end_date' => strtotime( '4th December 2019, 11:59:59PM' ),
106
+ 'render_cb' => [ __CLASS__, 'render_000Friday_offer' ],
107
+ ]
108
+ ];
109
+ }
110
+
111
+ public static function render_000Friday_offer( $id ) {
112
+ ?>
113
+ <div class="notice updated elementor-message is-dismissible ha-seeker" data-id="<?php echo $id; ?>">
114
+ <a href="https://happyaddons.com/pricing/" target="_blank" rel="noopener">
115
+ <img style="max-width:100%; height: auto; display: block;" src="<?php echo HAPPY_ADDONS_ASSETS ?>/imgs/bf-img.png" alt="Black Friday & Cyber Monday Offer - BFCM2019">
116
+ </a>
117
+ </div>
118
+ <?php
119
+ }
120
+ }
classes/extensions-manager.php CHANGED
@@ -2,6 +2,7 @@
2
  namespace Happy_Addons\Elementor;
3
 
4
  use Happy_Addons\Elementor\Extension\Background_Overlay;
 
5
  use Happy_Addons\Elementor\Extension\Happy_Effects;
6
 
7
  defined( 'ABSPATH' ) || die();
@@ -12,10 +13,12 @@ class Extensions_Manager {
12
  * Initialize
13
  */
14
  public static function init() {
15
- include HAPPY_ADDONS_DIR_PATH . 'extensions/background-overlay.php';
16
- include HAPPY_ADDONS_DIR_PATH . 'extensions/happy-effects.php';
 
17
 
18
- Background_Overlay::init();
19
  Happy_Effects::init();
 
 
20
  }
21
  }
2
  namespace Happy_Addons\Elementor;
3
 
4
  use Happy_Addons\Elementor\Extension\Background_Overlay;
5
+ use Happy_Addons\Elementor\Extension\Column_Extended;
6
  use Happy_Addons\Elementor\Extension\Happy_Effects;
7
 
8
  defined( 'ABSPATH' ) || die();
13
  * Initialize
14
  */
15
  public static function init() {
16
+ include_once HAPPY_ADDONS_DIR_PATH . 'extensions/background-overlay.php';
17
+ include_once HAPPY_ADDONS_DIR_PATH . 'extensions/happy-effects.php';
18
+ include_once HAPPY_ADDONS_DIR_PATH . 'extensions/column-extended.php';
19
 
 
20
  Happy_Effects::init();
21
+ Column_Extended::init();
22
+ Background_Overlay::init();
23
  }
24
  }
classes/widgets-manager.php CHANGED
@@ -60,11 +60,6 @@ class Widgets_Manager {
60
  */
61
  public static function get_pro_widget_map() {
62
  return [
63
- 'google-map' => [
64
- 'title' => __( 'Google Map', 'happy-elementor-addons' ),
65
- 'icon' => 'hm hm-map-marker',
66
- 'is_pro' => true,
67
- ],
68
  'advanced-heading' => [
69
  'title' => __( 'Advanced Heading', 'happy-elementor-addons' ),
70
  'icon' => 'hm hm-advanced-heading',
@@ -447,6 +442,16 @@ class Widgets_Manager {
447
  'css' => [],
448
  'js' => [],
449
  ],
 
 
 
 
 
 
 
 
 
 
450
  ],
451
  ];
452
  }
@@ -465,7 +470,7 @@ class Widgets_Manager {
465
  * @access public
466
  */
467
  public static function register() {
468
- require( HAPPY_ADDONS_DIR_PATH . 'base/widget-base.php' );
469
 
470
  $inactive_widgets = self::get_inactive_widgets();
471
 
@@ -479,7 +484,7 @@ class Widgets_Manager {
479
  protected static function register_widget( $widget_key ) {
480
  $widget_file = HAPPY_ADDONS_DIR_PATH . 'widgets/' . $widget_key . '/widget.php';
481
  if ( is_readable( $widget_file ) ) {
482
- include( $widget_file );
483
  $widget_class = '\Happy_Addons\Elementor\Widget\\' . str_replace( '-', '_', $widget_key );
484
  if ( class_exists( $widget_class ) ) {
485
  ha_elementor()->widgets_manager->register_widget_type( new $widget_class );
60
  */
61
  public static function get_pro_widget_map() {
62
  return [
 
 
 
 
 
63
  'advanced-heading' => [
64
  'title' => __( 'Advanced Heading', 'happy-elementor-addons' ),
65
  'icon' => 'hm hm-advanced-heading',
442
  'css' => [],
443
  'js' => [],
444
  ],
445
+ ],
446
+ 'gravityforms' => [
447
+ 'title' => __( 'Gravity Forms', 'happy-elementor-addons' ),
448
+ 'icon' => 'hm hm-form',
449
+ 'css' => [],
450
+ 'js' => [],
451
+ 'vendor' => [
452
+ 'css' => [],
453
+ 'js' => [],
454
+ ],
455
  ],
456
  ];
457
  }
470
  * @access public
471
  */
472
  public static function register() {
473
+ include_once( HAPPY_ADDONS_DIR_PATH . 'base/widget-base.php' );
474
 
475
  $inactive_widgets = self::get_inactive_widgets();
476
 
484
  protected static function register_widget( $widget_key ) {
485
  $widget_file = HAPPY_ADDONS_DIR_PATH . 'widgets/' . $widget_key . '/widget.php';
486
  if ( is_readable( $widget_file ) ) {
487
+ include_once( $widget_file );
488
  $widget_class = '\Happy_Addons\Elementor\Widget\\' . str_replace( '-', '_', $widget_key );
489
  if ( class_exists( $widget_class ) ) {
490
  ha_elementor()->widgets_manager->register_widget_type( new $widget_class );
extensions/column-extended.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Column Option Enhance functions
4
+ *
5
+ * @package Happy_Addons
6
+ */
7
+ namespace Happy_Addons\Elementor\Extension;
8
+
9
+ use Elementor\Controls_Manager;
10
+ use Elementor\Element_Column;
11
+
12
+ defined('ABSPATH') || die();
13
+
14
+ class Column_Extended {
15
+
16
+ public static function init() {
17
+ add_action( 'elementor/element/column/layout/before_section_end', [ __CLASS__, 'add_controls' ] );
18
+ }
19
+
20
+ public static function add_controls( Element_Column $element ) {
21
+ $element->add_control(
22
+ '_ha_column_features_heading',
23
+ [
24
+ 'label' => __( 'Happy Features', 'happy-elementor-addons' ),
25
+ 'type' => Controls_Manager::HEADING,
26
+ 'separator' => 'before',
27
+ ]
28
+ );
29
+
30
+ $element->add_responsive_control(
31
+ '_ha_column_width',
32
+ [
33
+ 'label' => __( 'Custom Column Width', 'happy-elementor-addons' ),
34
+ 'type' => Controls_Manager::TEXT,
35
+ 'label_block' => true,
36
+ 'description' => __( 'Here you can set the column width the way you always wanted to! e.g 250px, 50%, calc(100% - 250px)', 'happy-elementor-addons' ),
37
+ 'selectors' => [
38
+ '{{WRAPPER}}.elementor-column' => 'width: {{VALUE}};',
39
+ ],
40
+ ]
41
+ );
42
+
43
+ $element->add_responsive_control(
44
+ '_ha_column_order',
45
+ [
46
+ 'label' => __( 'Column Order', 'happy-elementor-addons' ),
47
+ 'type' => Controls_Manager::NUMBER,
48
+ 'style_transfer' => true,
49
+ 'selectors' => [
50
+ '{{WRAPPER}}.elementor-column' => '-webkit-box-ordinal-group: calc({{VALUE}} + 1 ); -ms-flex-order:{{VALUE}}; order: {{VALUE}};',
51
+ ],
52
+ 'description' => sprintf(
53
+ __( 'Column ordering is a great addition for responsive design. You can learn more about CSS order property from %sMDN%s.', 'happy-elementor-addons' ),
54
+ '<a
55
+ href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Ordering_Flex_Items#The_order_property" target="_blank">',
56
+ '</a>'
57
+ ),
58
+ ]
59
+ );
60
+ }
61
+ }
inc/functions-forms.php CHANGED
@@ -52,6 +52,15 @@ function ha_is_weforms_activated() {
52
  return class_exists( 'WeForms' );
53
  }
54
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Get a list of all CF7 forms
57
  *
@@ -158,3 +167,22 @@ function ha_get_we_forms() {
158
  }
159
  return $forms;
160
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  return class_exists( 'WeForms' );
53
  }
54
 
55
+ /**
56
+ * Check if Gravity Forms is activated
57
+ *
58
+ * @return bool
59
+ */
60
+ function ha_is_gravityforms_activated() {
61
+ return class_exists( 'GFForms' );
62
+ }
63
+
64
  /**
65
  * Get a list of all CF7 forms
66
  *
167
  }
168
  return $forms;
169
  }
170
+
171
+ /**
172
+ * Get a list of all GravityForms
173
+ *
174
+ * @return array
175
+ */
176
+ function ha_get_gravity_forms() {
177
+ $forms = [];
178
+ if ( ha_is_gravityforms_activated() ) {
179
+ $gravity_forms = \RGFormsModel::get_forms( null, 'title' );
180
+
181
+ if ( ! empty( $gravity_forms ) && ! is_wp_error( $gravity_forms ) ) {
182
+ foreach ( $gravity_forms as $gravity_form ) {
183
+ $forms[ $gravity_form->id ] = $gravity_form->title;
184
+ }
185
+ }
186
+ }
187
+ return $forms;
188
+ }
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Happy Elementor Addons
4
  * Plugin URI: https://happyaddons.com/
5
  * Description: <a href="https://happyaddons.com/">HappyAddons</a> is a collection of slick, powerful widgets that works seamlessly with Elementor page builder. It’s trendy look with detail customization features allows to create extraordinary designs instantly. <a href="https://happyaddons.com/">HappyAddons</a> is free, rapidly growing and comes with great support.
6
- * Version: 2.2.6
7
  * Author: weDevs
8
  * Author URI: https://happyaddons.com/
9
  * License: GPLv2
@@ -34,7 +34,7 @@ Copyright 2019 HappyMonster <http://happymonster.me>
34
 
35
  defined( 'ABSPATH' ) || die();
36
 
37
- define( 'HAPPY_ADDONS_VERSION', '2.2.6' );
38
  define( 'HAPPY_ADDONS__FILE__', __FILE__ );
39
  define( 'HAPPY_ADDONS_DIR_PATH', plugin_dir_path( HAPPY_ADDONS__FILE__ ) );
40
  define( 'HAPPY_ADDONS_DIR_URL', plugin_dir_url( HAPPY_ADDONS__FILE__ ) );
3
  * Plugin Name: Happy Elementor Addons
4
  * Plugin URI: https://happyaddons.com/
5
  * Description: <a href="https://happyaddons.com/">HappyAddons</a> is a collection of slick, powerful widgets that works seamlessly with Elementor page builder. It’s trendy look with detail customization features allows to create extraordinary designs instantly. <a href="https://happyaddons.com/">HappyAddons</a> is free, rapidly growing and comes with great support.
6
+ * Version: 2.3.0
7
  * Author: weDevs
8
  * Author URI: https://happyaddons.com/
9
  * License: GPLv2
34
 
35
  defined( 'ABSPATH' ) || die();
36
 
37
+ define( 'HAPPY_ADDONS_VERSION', '2.3.0' );
38
  define( 'HAPPY_ADDONS__FILE__', __FILE__ );
39
  define( 'HAPPY_ADDONS_DIR_PATH', plugin_dir_path( HAPPY_ADDONS__FILE__ ) );
40
  define( 'HAPPY_ADDONS_DIR_URL', plugin_dir_url( HAPPY_ADDONS__FILE__ ) );
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === Happy Elementor Addons ===
2
  Plugin Name: Happy Elementor Addons
3
- Version: 2.2.6
4
  Author: weDevs
5
  Author URI: https://happyaddons.com/
6
  Contributors: thehappymonster, happyaddons, hasinhayder, mosaddek73, tareq1988, sourav926, wedevs, iqbalrony, obiplabon
@@ -145,6 +145,14 @@ It's really easy and super simple to install **Happy Elementor Addons** plugin b
145
 
146
  == Changelog ==
147
 
 
 
 
 
 
 
 
 
148
  = 2.2.6 - 11 November 2019 =
149
 
150
  - Fix: Conflict with Essential Addons causing PHP fatal error
1
  === Happy Elementor Addons ===
2
  Plugin Name: Happy Elementor Addons
3
+ Version: 2.3.0
4
  Author: weDevs
5
  Author URI: https://happyaddons.com/
6
  Contributors: thehappymonster, happyaddons, hasinhayder, mosaddek73, tareq1988, sourav926, wedevs, iqbalrony, obiplabon
145
 
146
  == Changelog ==
147
 
148
+ = 2.3.0 - 20 November 2019 =
149
+
150
+ - New: Gravity Forms Widget
151
+ - New: Column Order control
152
+ - New: Custom Column Width control
153
+ - New: weForms section break styles
154
+ - Fix: weForms misc style issues
155
+
156
  = 2.2.6 - 11 November 2019 =
157
 
158
  - Fix: Conflict with Essential Addons causing PHP fatal error
widgets/gravityforms/widget.php ADDED
@@ -0,0 +1,913 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GravityForms widget class
4
+ *
5
+ * @package Happy_Addons
6
+ */
7
+ namespace Happy_Addons\Elementor\Widget;
8
+
9
+ use Elementor\Controls_Manager;
10
+ use Elementor\Group_Control_Border;
11
+ use Elementor\Group_Control_Box_Shadow;
12
+ use Elementor\Group_Control_Typography;
13
+ use Elementor\Scheme_Typography;
14
+
15
+ defined( 'ABSPATH' ) || die();
16
+
17
+ class GravityForms extends Base {
18
+
19
+ /**
20
+ * Get widget title.
21
+ *
22
+ * @since 1.0.0
23
+ * @access public
24
+ *
25
+ * @return string Widget title.
26
+ */
27
+ public function get_title() {
28
+ return __( 'Gravity Forms', 'happy-elementor-addons' );
29
+ }
30
+
31
+ /**
32
+ * Get widget icon.
33
+ *
34
+ * @since 1.0.0
35
+ * @access public
36
+ *
37
+ * @return string Widget icon.
38
+ */
39
+ public function get_icon() {
40
+ return 'hm hm-form';
41
+ }
42
+
43
+ public function get_keywords() {
44
+ return [ 'gravity forms', 'form', 'contact', 'advanced', 'ninja' ];
45
+ }
46
+
47
+ // Whether the reload preview is required or not.
48
+ public function is_reload_preview_required() {
49
+ return true;
50
+ }
51
+
52
+ protected function register_content_controls() {
53
+ $this->start_controls_section(
54
+ '_section_gravityforms',
55
+ [
56
+ 'label' => ha_is_gravityforms_activated() ? __( 'Gravity Forms', 'happy-elementor-addons' ) : __( 'Missing Notice',
57
+ 'happy-elementor-addons' ),
58
+ 'tab' => Controls_Manager::TAB_CONTENT,
59
+ ]
60
+ );
61
+
62
+ if ( ! ha_is_gravityforms_activated() ) {
63
+ $this->add_control(
64
+ '_gravityforms_missing_notice',
65
+ [
66
+ 'type' => Controls_Manager::RAW_HTML,
67
+ 'raw' => sprintf(
68
+ __( 'Hello %1$s, looks like Gravity Forms is missing in your site. Please install/activate Gravity Forms. Make sure to refresh this page after installation or activation.', 'happy-elementor-addons' ),
69
+ ha_get_current_user_display_name()
70
+ ),
71
+ 'content_classes' => 'elementor-panel-alert elementor-panel-alert-danger',
72
+ ]
73
+ );
74
+
75
+ $this->end_controls_section();
76
+ return;
77
+ }
78
+
79
+ $this->add_control(
80
+ 'form_id',
81
+ [
82
+ 'label' => __( 'Select Your Form', 'happy-elementor-addons' ),
83
+ 'type' => Controls_Manager::SELECT,
84
+ 'label_block' => true,
85
+ 'options' => ['' => __( '', 'happy-elementor-addons' ) ] + \ha_get_gravity_forms(),
86
+ ]
87
+ );
88
+
89
+ $this->add_control(
90
+ 'form_title_show',
91
+ [
92
+ 'label' => __( 'Form Title', 'happy-elementor-addons' ),
93
+ 'type' => Controls_Manager::SWITCHER,
94
+ 'separator' => 'before',
95
+ 'label_on' => __( 'Show', 'happy-elementor-addons' ),
96
+ 'label_off' => __( 'Hide', 'happy-elementor-addons' ),
97
+ 'return_value' => 'yes',
98
+ 'default' => 'yes',
99
+ ]
100
+ );
101
+
102
+ $this->end_controls_section();
103
+ }
104
+
105
+ protected function register_style_controls() {
106
+ $this->start_controls_section(
107
+ '_section_fields_style',
108
+ [
109
+ 'label' => __( 'Form Fields', 'happy-elementor-addons' ),
110
+ 'tab' => Controls_Manager::TAB_STYLE,
111
+ ]
112
+ );
113
+
114
+ $this->add_responsive_control(
115
+ 'large_field_width',
116
+ [
117
+ 'label' => __( 'Large Field Width', 'happy-elementor-addons' ),
118
+ 'type' => Controls_Manager::SLIDER,
119
+ 'size_units' => [ 'px', '%' ],
120
+ 'range' => [
121
+ '%' => [
122
+ 'min' => 1,
123
+ 'max' => 100,
124
+ ],
125
+ 'px' => [
126
+ 'min' => 1,
127
+ 'max' => 800,
128
+ ],
129
+ ],
130
+ 'selectors' => [
131
+ '{{WRAPPER}} .gform_body .gfield input.large' => 'width: {{SIZE}}{{UNIT}};',
132
+ '{{WRAPPER}} .gform_body .gfield textarea.large' => 'width: {{SIZE}}{{UNIT}};',
133
+ ],
134
+ ]
135
+ );
136
+
137
+ $this->add_responsive_control(
138
+ 'field_margin',
139
+ [
140
+ 'label' => __( 'Field Spacing', 'happy-elementor-addons' ),
141
+ 'type' => Controls_Manager::DIMENSIONS,
142
+ 'size_units' => [ 'px', '%' ],
143
+ 'selectors' => [
144
+ '{{WRAPPER}} .gform_body .gform_fields .gfield' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
145
+ ],
146
+ ]
147
+ );
148
+
149
+ $this->add_responsive_control(
150
+ 'field_padding',
151
+ [
152
+ 'label' => __( 'Padding', 'happy-elementor-addons' ),
153
+ 'type' => Controls_Manager::DIMENSIONS,
154
+ 'size_units' => [ 'px', '%' ],
155
+ 'selectors' => [
156
+ '{{WRAPPER}} .gfield .ginput_container:not(.ginput_container_fileupload) > input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
157
+ '{{WRAPPER}} .gfield .ginput_container.ginput_complex input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
158
+ '{{WRAPPER}} .gform_body .gfield textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
159
+ ],
160
+ ]
161
+ );
162
+
163
+ $this->add_responsive_control(
164
+ 'field_border_radius',
165
+ [
166
+ 'label' => __( 'Border Radius', 'happy-elementor-addons' ),
167
+ 'type' => Controls_Manager::DIMENSIONS,
168
+ 'size_units' => [ 'px', '%' ],
169
+ 'selectors' => [
170
+ '{{WRAPPER}} .gfield .ginput_container:not(.ginput_container_fileupload) > input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
171
+ '{{WRAPPER}} .gfield .ginput_container.ginput_complex input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
172
+ '{{WRAPPER}} .gform_body .gfield textarea' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
173
+ ],
174
+ ]
175
+ );
176
+
177
+ $this->add_group_control(
178
+ Group_Control_Typography::get_type(),
179
+ [
180
+ 'name' => 'field_typography',
181
+ 'label' => __( 'Typography', 'happy-elementor-addons' ),
182
+ 'selector' => '{{WRAPPER}} .gfield .ginput_container > input, {{WRAPPER}} .gform_body .gfield textarea, {{WRAPPER}} .gfield .ginput_container.ginput_complex input',
183
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_3
184
+ ]
185
+ );
186
+
187
+ $this->add_control(
188
+ 'field_textcolor',
189
+ [
190
+ 'label' => __( 'Field Text Color', 'happy-elementor-addons' ),
191
+ 'type' => Controls_Manager::COLOR,
192
+ 'selectors' => [
193
+ '{{WRAPPER}} .gfield .ginput_container > input' => 'color: {{VALUE}};',
194
+ '{{WRAPPER}} .gfield .ginput_container.ginput_complex input' => 'color: {{VALUE}};',
195
+ '{{WRAPPER}} .gform_body .gfield textarea' => 'color: {{VALUE}};',
196
+ '{{WRAPPER}} .gform_body .gfield select' => 'color: {{VALUE}};',
197
+ '{{WRAPPER}} .gfield_list tbody td input' => 'color: {{VALUE}};',
198
+ '{{WRAPPER}} .ginput_container_address input' => 'color: {{VALUE}};',
199
+ ],
200
+ ]
201
+ );
202
+
203
+ $this->add_control(
204
+ 'field_placeholder_color',
205
+ [
206
+ 'label' => __( 'Field Placeholder Color', 'happy-elementor-addons' ),
207
+ 'type' => Controls_Manager::COLOR,
208
+ 'selectors' => [
209
+ '{{WRAPPER}} ::-webkit-input-placeholder' => 'color: {{VALUE}};',
210
+ '{{WRAPPER}} ::-moz-placeholder' => 'color: {{VALUE}};',
211
+ '{{WRAPPER}} ::-ms-input-placeholder' => 'color: {{VALUE}};',
212
+ ],
213
+ ]
214
+ );
215
+
216
+ $this->start_controls_tabs( 'tabs_field_state' );
217
+
218
+ $this->start_controls_tab(
219
+ 'tab_field_normal',
220
+ [
221
+ 'label' => __( 'Normal', 'happy-elementor-addons' ),
222
+ ]
223
+ );
224
+
225
+ $this->add_group_control(
226
+ Group_Control_Border::get_type(),
227
+ [
228
+ 'name' => 'field_border',
229
+ 'selector' => '{{WRAPPER}} .gfield .ginput_container:not(.ginput_container_fileupload) > input,
230
+ {{WRAPPER}} .gfield .ginput_complex input,
231
+ {{WRAPPER}} .gfield .ginput_container_address input,
232
+ {{WRAPPER}} .gfield_list_cell input,
233
+ {{WRAPPER}} .gfield .ginput_container select,
234
+ {{WRAPPER}} .gform_body .gfield textarea',
235
+ ]
236
+ );
237
+
238
+ $this->add_group_control(
239
+ Group_Control_Box_Shadow::get_type(),
240
+ [
241
+ 'name' => 'field_box_shadow',
242
+ 'selector' => '{{WRAPPER}} .gfield .ginput_container:not(.ginput_container_fileupload) > input,
243
+ {{WRAPPER}} .gfield .ginput_complex input,
244
+ {{WRAPPER}} .gfield .ginput_container_address input,
245
+ {{WRAPPER}} .gform_body .gfield textarea',
246
+ ]
247
+ );
248
+
249
+ $this->add_control(
250
+ 'field_bg_color',
251
+ [
252
+ 'label' => __( 'Background Color', 'happy-elementor-addons' ),
253
+ 'type' => Controls_Manager::COLOR,
254
+ 'selectors' => [
255
+ '{{WRAPPER}} .gfield .ginput_container:not(.ginput_container_fileupload) > input' => 'background-color: {{VALUE}}',
256
+ '{{WRAPPER}} .gfield .ginput_complex input' => 'background-color: {{VALUE}}',
257
+ '{{WRAPPER}} .gfield .ginput_container_address input' => 'background-color: {{VALUE}}',
258
+ '{{WRAPPER}} .gfield .ginput_container_list input' => 'background-color: {{VALUE}}',
259
+ '{{WRAPPER}} .gform_body .gfield textarea' => 'background-color: {{VALUE}}',
260
+ '{{WRAPPER}} .gform_body .gfield select' => 'background-color: {{VALUE}}',
261
+ ],
262
+ ]
263
+ );
264
+
265
+ $this->end_controls_tab();
266
+
267
+ $this->start_controls_tab(
268
+ 'tab_field_focus',
269
+ [
270
+ 'label' => __( 'Focus', 'happy-elementor-addons' ),
271
+ ]
272
+ );
273
+
274
+ $this->add_group_control(
275
+ Group_Control_Border::get_type(),
276
+ [
277
+ 'name' => 'field_focus_border',
278
+ 'selector' => '{{WRAPPER}} .gfield .ginput_container > input:focus,
279
+ {{WRAPPER}} .gfield .ginput_complex input:focus,
280
+ {{WRAPPER}} .gfield .ginput_container_address input:focus,
281
+ {{WRAPPER}} .gfield_list_cell input:focus,
282
+ {{WRAPPER}} .gform_body .gfield textarea:focus'
283
+ ]
284
+ );
285
+
286
+ $this->add_group_control(
287
+ Group_Control_Box_Shadow::get_type(),
288
+ [
289
+ 'name' => 'field_focus_box_shadow',
290
+ 'selector' => '{{WRAPPER}} .gfield .ginput_container > input:focus,
291
+ {{WRAPPER}} .gfield .ginput_complex input:focus,
292
+ {{WRAPPER}} .gfield .ginput_container_address input:focus,
293
+ {{WRAPPER}} .gform_body .gfield textarea:focus',
294
+ ]
295
+ );
296
+
297
+ $this->add_control(
298
+ 'field_focus_bg_color',
299
+ [
300
+ 'label' => __( 'Background Color', 'happy-elementor-addons' ),
301
+ 'type' => Controls_Manager::COLOR,
302
+ 'selectors' => [
303
+ '{{WRAPPER}} .gfield .ginput_container > input:focus' => 'background-color: {{VALUE}}',
304
+ '{{WRAPPER}} .gfield .ginput_complex input:focus' => 'background-color: {{VALUE}}',
305
+ '{{WRAPPER}} .gform_body .gfield textarea:focus' => 'background-color: {{VALUE}}',
306
+ ],
307
+ ]
308
+ );
309
+
310
+ $this->end_controls_tab();
311
+ $this->end_controls_tabs();
312
+
313
+ $this->end_controls_section();
314
+
315
+
316
+ $this->start_controls_section(
317
+ 'form-label',
318
+ [
319
+ 'label' => __( 'Form Fields Label', 'happy-elementor-addons' ),
320
+ 'tab' => Controls_Manager::TAB_STYLE,
321
+ ]
322
+ );
323
+
324
+ $this->add_responsive_control(
325
+ 'label_margin',
326
+ [
327
+ 'label' => __( 'Margin', 'happy-elementor-addons' ),
328
+ 'type' => Controls_Manager::DIMENSIONS,
329
+ 'size_units' => [ 'px', '%' ],
330
+ 'selectors' => [
331
+ '{{WRAPPER}} .gform_body .gfield .gfield_label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
332
+ ],
333
+ ]
334
+ );
335
+
336
+ $this->add_responsive_control(
337
+ 'label_padding',
338
+ [
339
+ 'label' => __( 'Padding', 'happy-elementor-addons' ),
340
+ 'type' => Controls_Manager::DIMENSIONS,
341
+ 'size_units' => [ 'px', 'em', '%' ],
342
+ 'selectors' => [
343
+ '{{WRAPPER}} .gform_body .gfield .gfield_label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
344
+ ],
345
+ ]
346
+ );
347
+
348
+ $this->add_responsive_control(
349
+ 'sub_label_margin',
350
+ [
351
+ 'label' => __( 'Sub Label Margin', 'happy-elementor-addons' ),
352
+ 'type' => Controls_Manager::DIMENSIONS,
353
+ 'size_units' => [ 'px', '%' ],
354
+ 'separator' => 'after',
355
+ 'selectors' => [
356
+ '{{WRAPPER}} .gform_body .gfield .ginput_complex label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
357
+ ],
358
+ ]
359
+ );
360
+
361
+ $this->add_group_control(
362
+ Group_Control_Typography::get_type(),
363
+ [
364
+ 'name' => 'label_typography',
365
+ 'label' => __( 'Label Typography', 'happy-elementor-addons' ),
366
+ 'selector' => '{{WRAPPER}} .gform_body .gfield .gfield_label',
367
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
368
+ ]
369
+ );
370
+
371
+ $this->add_group_control(
372
+ Group_Control_Typography::get_type(),
373
+ [
374
+ 'name' => 'sub_label_typography',
375
+ 'label' => __( 'Sub Label Typography', 'happy-elementor-addons' ),
376
+ 'selector' => '{{WRAPPER}} .gform_body .gfield .ginput_complex label',
377
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
378
+ ]
379
+ );
380
+
381
+ $this->add_control(
382
+ 'label_color',
383
+ [
384
+ 'label' => __( 'Label Text Color', 'happy-elementor-addons' ),
385
+ 'type' => Controls_Manager::COLOR,
386
+ 'selectors' => [
387
+ '{{WRAPPER}} .gform_body .gfield .gfield_label' => 'color: {{VALUE}}',
388
+ '{{WRAPPER}} .gform_body .gfield .ginput_complex label' => 'color: {{VALUE}}',
389
+ '{{WRAPPER}} .gfield .gfield_list thead th' => 'color: {{VALUE}}',
390
+ ],
391
+ ]
392
+ );
393
+
394
+ $this->add_control(
395
+ 'requered_label',
396
+ [
397
+ 'label' => __( 'Required Label Color', 'happy-elementor-addons' ),
398
+ 'type' => Controls_Manager::COLOR,
399
+ 'selectors' => [
400
+ '{{WRAPPER}} .gform_body .gfield .gfield_label .gfield_required' => 'color: {{VALUE}}',
401
+ ],
402
+ ]
403
+ );
404
+
405
+ $this->end_controls_section();
406
+
407
+ $this->start_controls_section(
408
+ 'submit',
409
+ [
410
+ 'label' => __( 'Submit Button', 'happy-elementor-addons' ),
411
+ 'tab' => Controls_Manager::TAB_STYLE,
412
+ ]
413
+ );
414
+
415
+ $this->add_control(
416
+ 'submit_btn_width',
417
+ [
418
+ 'label' => __( 'Button Full Width?', 'happy-elementor-addons' ),
419
+ 'type' => Controls_Manager::SWITCHER,
420
+ 'label_on' => __( 'Yes', 'happy-elementor-addons' ),
421
+ 'label_off' => __( 'No', 'happy-elementor-addons' ),
422
+ 'return_value' => 'yes',
423
+ 'default' => '',
424
+ ]
425
+ );
426
+
427
+ $this->add_responsive_control(
428
+ 'button_width',
429
+ [
430
+ 'label' => __( 'Button Width', 'happy-elementor-addons' ),
431
+ 'type' => Controls_Manager::SLIDER,
432
+ 'size_units' => [ 'px', '%' ],
433
+ 'condition' => [
434
+ 'submit_btn_width' => 'yes'
435
+ ],
436
+ 'default' => [
437
+ 'unit' => '%',
438
+ 'size' => 100
439
+ ],
440
+ 'range' => [
441
+ '%' => [
442
+ 'min' => 1,
443
+ 'max' => 100,
444
+ ],
445
+ 'px' => [
446
+ 'min' => 1,
447
+ 'max' => 800,
448
+ ],
449
+ ],
450
+ 'selectors' => [
451
+ '{{WRAPPER}} .gform_wrapper .gform_button' => 'width: {{SIZE}}{{UNIT}};',
452
+ ],
453
+ ]
454
+ );
455
+
456
+ $this->add_control(
457
+ 'submit_btn_position',
458
+ [
459
+ 'label' => __( 'Button Position', 'happy-elementor-addons' ),
460
+ 'type' => Controls_Manager::CHOOSE,
461
+ 'options' => [
462
+ 'left' => [
463
+ 'title' => __( 'Left', 'happy-elementor-addons' ),
464
+ 'icon' => 'eicon-h-align-left',
465
+ ],
466
+ 'center' => [
467
+ 'title' => __( 'Center', 'happy-elementor-addons' ),
468
+ 'icon' => 'eicon-h-align-center',
469
+ ],
470
+ 'right' => [
471
+ 'title' => __( 'Right', 'happy-elementor-addons' ),
472
+ 'icon' => 'eicon-h-align-right',
473
+ ],
474
+ ],
475
+ 'condition' => [
476
+ 'submit_btn_width' => ''
477
+ ],
478
+ 'default' => 'left',
479
+ 'selectors' => [
480
+ '{{WRAPPER}} .gform_wrapper .gform_footer' => 'text-align: {{Value}};',
481
+ ],
482
+ ]
483
+ );
484
+
485
+ $this->add_responsive_control(
486
+ 'submit_margin',
487
+ [
488
+ 'label' => __( 'Margin', 'happy-elementor-addons' ),
489
+ 'type' => Controls_Manager::DIMENSIONS,
490
+ 'size_units' => [ 'px', '%' ],
491
+ 'selectors' => [
492
+ '{{WRAPPER}} .gform_wrapper .gform_footer' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
493
+ ],
494
+ ]
495
+ );
496
+
497
+ $this->add_responsive_control(
498
+ 'submit_padding',
499
+ [
500
+ 'label' => __( 'Padding', 'happy-elementor-addons' ),
501
+ 'type' => Controls_Manager::DIMENSIONS,
502
+ 'size_units' => [ 'px', '%' ],
503
+ 'selectors' => [
504
+ '{{WRAPPER}} .gform_wrapper .gform_button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
505
+ ],
506
+ ]
507
+ );
508
+
509
+ $this->add_group_control(
510
+ Group_Control_Typography::get_type(),
511
+ [
512
+ 'name' => 'submit_typography',
513
+ 'selector' => '{{WRAPPER}} .gform_wrapper .gform_button',
514
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_4
515
+ ]
516
+ );
517
+
518
+ $this->add_group_control(
519
+ Group_Control_Border::get_type(),
520
+ [
521
+ 'name' => 'submit_border',
522
+ 'selector' => '{{WRAPPER}} .gform_wrapper .gform_button',
523
+ ]
524
+ );
525
+
526
+ $this->add_control(
527
+ 'submit_border_radius',
528
+ [
529
+ 'label' => __( 'Border Radius', 'happy-elementor-addons' ),
530
+ 'type' => Controls_Manager::DIMENSIONS,
531
+ 'size_units' => [ 'px', '%' ],
532
+ 'selectors' => [
533
+ '{{WRAPPER}} .gform_wrapper .gform_button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
534
+ ],
535
+ ]
536
+ );
537
+
538
+ $this->add_group_control(
539
+ Group_Control_Box_Shadow::get_type(),
540
+ [
541
+ 'name' => 'submit_box_shadow',
542
+ 'selector' => '{{WRAPPER}} .gform_wrapper .gform_button',
543
+ 'separator' => 'after'
544
+ ]
545
+ );
546
+
547
+ $this->start_controls_tabs( 'tabs_button_style' );
548
+
549
+ $this->start_controls_tab(
550
+ 'tab_button_normal',
551
+ [
552
+ 'label' => __( 'Normal', 'happy-elementor-addons' ),
553
+ ]
554
+ );
555
+
556
+ $this->add_control(
557
+ 'submit_color',
558
+ [
559
+ 'label' => __( 'Text Color', 'happy-elementor-addons' ),
560
+ 'type' => Controls_Manager::COLOR,
561
+ 'default' => '',
562
+ 'selectors' => [
563
+ '{{WRAPPER}} .gform_wrapper .gform_button' => 'color: {{VALUE}};',
564
+ ],
565
+ ]
566
+ );
567
+
568
+ $this->add_control(
569
+ 'submit_bg_color',
570
+ [
571
+ 'label' => __( 'Background Color', 'happy-elementor-addons' ),
572
+ 'type' => Controls_Manager::COLOR,
573
+ 'selectors' => [
574
+ '{{WRAPPER}} .gform_wrapper .gform_button' => 'background-color: {{VALUE}};',
575
+ ],
576
+ ]
577
+ );
578
+
579
+ $this->end_controls_tab();
580
+
581
+ $this->start_controls_tab(
582
+ 'tab_button_hover',
583
+ [
584
+ 'label' => __( 'Hover', 'happy-elementor-addons' ),
585
+ ]
586
+ );
587
+
588
+ $this->add_control(
589
+ 'submit_hover_color',
590
+ [
591
+ 'label' => __( 'Text Color', 'happy-elementor-addons' ),
592
+ 'type' => Controls_Manager::COLOR,
593
+ 'selectors' => [
594
+ '{{WRAPPER}} .gform_wrapper .gform_button:hover' => 'color: {{VALUE}};',
595
+ '{{WRAPPER}} .gform_wrapper .gform_button:focus' => 'color: {{VALUE}};',
596
+ ],
597
+ ]
598
+ );
599
+
600
+ $this->add_control(
601
+ 'submit_hover_bg_color',
602
+ [
603
+ 'label' => __( 'Background Color', 'happy-elementor-addons' ),
604
+ 'type' => Controls_Manager::COLOR,
605
+ 'selectors' => [
606
+ '{{WRAPPER}} .gform_wrapper .gform_button:hover' => 'background-color: {{VALUE}};',
607
+ '{{WRAPPER}} .gform_wrapper .gform_button:focus' => 'background-color: {{VALUE}};',
608
+ ],
609
+ ]
610
+ );
611
+
612
+ $this->add_control(
613
+ 'submit_hover_border_color',
614
+ [
615
+ 'label' => __( 'Border Color', 'happy-elementor-addons' ),
616
+ 'type' => Controls_Manager::COLOR,
617
+ 'selectors' => [
618
+ '{{WRAPPER}} .gform_wrapper .gform_button:hover' => 'border-color: {{VALUE}};',
619
+ '{{WRAPPER}} .gform_wrapper .gform_button:focus' => 'border-color: {{VALUE}};',
620
+ ],
621
+ ]
622
+ );
623
+
624
+ $this->end_controls_tab();
625
+ $this->end_controls_tabs();
626
+
627
+ $this->end_controls_section();
628
+
629
+ $this->start_controls_section(
630
+ '_break',
631
+ [
632
+ 'label' => __( 'Break', 'happy-elementor-addons' ),
633
+ 'tab' => Controls_Manager::TAB_STYLE,
634
+ ]
635
+ );
636
+
637
+ $this->add_control(
638
+ 'section_break',
639
+ [
640
+ 'label' => __( 'Section Break', 'plugin-name' ),
641
+ 'type' => Controls_Manager::HEADING,
642
+ ]
643
+ );
644
+
645
+ $this->add_group_control(
646
+ Group_Control_Typography::get_type(),
647
+ [
648
+ 'name' => 'section_break_title_typography',
649
+ 'label' => __( 'Title Typography', 'happy-elementor-addons' ),
650
+ 'selector' => '{{WRAPPER}} .gsection .gsection_title',
651
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_2
652
+ ]
653
+ );
654
+
655
+ $this->add_group_control(
656
+ Group_Control_Typography::get_type(),
657
+ [
658
+ 'name' => 'section_break_description_typography',
659
+ 'label' => __( 'Description Typography', 'happy-elementor-addons' ),
660
+ 'selector' => '{{WRAPPER}} .gsection .gsection_description',
661
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_4
662
+ ]
663
+ );
664
+
665
+ $this->start_controls_tabs( 'tabs_section_break_style' );
666
+ $this->start_controls_tab(
667
+ 'section_break__title',
668
+ [
669
+ 'label' => __( 'Title', 'happy-elementor-addons' ),
670
+ ]
671
+ );
672
+
673
+ $this->add_control(
674
+ 'section_break_title_color',
675
+ [
676
+ 'label' => __( 'Color', 'happy-elementor-addons' ),
677
+ 'type' => Controls_Manager::COLOR,
678
+ 'selectors' => [
679
+ '{{WRAPPER}} .gsection .gsection_title' => 'color: {{VALUE}};',
680
+ ],
681
+ ]
682
+ );
683
+
684
+ $this->end_controls_tab();
685
+
686
+ $this->start_controls_tab(
687
+ 'section_break_tab_description',
688
+ [
689
+ 'label' => __( 'Description', 'happy-elementor-addons' ),
690
+ ]
691
+ );
692
+
693
+ $this->add_control(
694
+ 'section_break_description_color',
695
+ [
696
+ 'label' => __( 'Color', 'happy-elementor-addons' ),
697
+ 'type' => Controls_Manager::COLOR,
698
+ 'selectors' => [
699
+ '{{WRAPPER}} .gsection .gsection_description' => 'color: {{VALUE}};',
700
+ ],
701
+ ]
702
+ );
703
+
704
+ $this->end_controls_tab();
705
+ $this->end_controls_tabs();
706
+
707
+ $this->add_control(
708
+ 'page_break',
709
+ [
710
+ 'label' => __( 'Page Break', 'happy-elementor-addons' ),
711
+ 'type' => Controls_Manager::HEADING,
712
+ 'separator' => 'before'
713
+ ]
714
+ );
715
+
716
+ $this->add_control(
717
+ 'page_break_progress_bar_color',
718
+ [
719
+ 'label' => __( 'Progress bar background Color', 'happy-elementor-addons' ),
720
+ 'type' => Controls_Manager::COLOR,
721
+ 'selectors' => [
722
+ '{{WRAPPER}} .gform_wrapper .percentbar_blue' => 'background-color: {{VALUE}};',
723
+ ],
724
+ ]
725
+ );
726
+
727
+ $this->add_group_control(
728
+ Group_Control_Box_Shadow::get_type(),
729
+ [
730
+ 'name' => 'page_break_button_box_shadow',
731
+ 'label' => __( 'Button Box Shadow', 'happy-elementor-addons' ),
732
+ 'selector' => '{{WRAPPER}} .gform_next_button.button, {{WRAPPER}} .gform_previous_button.button',
733
+ ]
734
+ );
735
+
736
+ $this->add_group_control(
737
+ Group_Control_Border::get_type(),
738
+ [
739
+ 'name' => 'page_break_button_border',
740
+ 'selector' => '{{WRAPPER}} .gform_next_button.button, {{WRAPPER}} .gform_previous_button.button',
741
+ ]
742
+ );
743
+
744
+ $this->add_control(
745
+ 'page_break_button_border_radius',
746
+ [
747
+ 'label' => __( 'Button Border Radius', 'happy-elementor-addons' ),
748
+ 'type' => Controls_Manager::DIMENSIONS,
749
+ 'size_units' => [ 'px', '%' ],
750
+ 'selectors' => [
751
+ '{{WRAPPER}} .gform_next_button.button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
752
+ '{{WRAPPER}} .gform_previous_button.button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
753
+ ],
754
+ ]
755
+ );
756
+
757
+ $this->start_controls_tabs( 'page_break_tabs_button_style' );
758
+
759
+ $this->start_controls_tab(
760
+ 'page_break_tab_button_normal',
761
+ [
762
+ 'label' => __( 'Normal', 'happy-elementor-addons' ),
763
+ ]
764
+ );
765
+
766
+ $this->add_control(
767
+ 'page_break_color',
768
+ [
769
+ 'label' => __( 'Text Color', 'happy-elementor-addons' ),
770
+ 'type' => Controls_Manager::COLOR,
771
+ 'default' => '',
772
+ 'selectors' => [
773
+ '{{WRAPPER}} .gform_next_button.button' => 'color: {{VALUE}};',
774
+ '{{WRAPPER}} .gform_previous_button.button' => 'color: {{VALUE}};',
775
+ ],
776
+ ]
777
+ );
778
+
779
+ $this->add_control(
780
+ 'page_break_bg_color',
781
+ [
782
+ 'label' => __( 'Background Color', 'happy-elementor-addons' ),
783
+ 'type' => Controls_Manager::COLOR,
784
+ 'selectors' => [
785
+ '{{WRAPPER}} .gform_next_button.button' => 'background-color: {{VALUE}};',
786
+ '{{WRAPPER}} .gform_previous_button.button' => 'background-color: {{VALUE}};',
787
+ ],
788
+ ]
789
+ );
790
+
791
+ $this->end_controls_tab();
792
+
793
+ $this->start_controls_tab(
794
+ 'page_break_tab_button_hover',
795
+ [
796
+ 'label' => __( 'Hover', 'happy-elementor-addons' ),
797
+ ]
798
+ );
799
+
800
+ $this->add_control(
801
+ 'page_break_hover_color',
802
+ [
803
+ 'label' => __( 'Text Color', 'happy-elementor-addons' ),
804
+ 'type' => Controls_Manager::COLOR,
805
+ 'selectors' => [
806
+ '{{WRAPPER}} .gform_next_button.button:hover' => 'color: {{VALUE}};',
807
+ '{{WRAPPER}} .gform_next_button.button:focus' => 'color: {{VALUE}};',
808
+ '{{WRAPPER}} .gform_previous_button.button:hover' => 'color: {{VALUE}};',
809
+ '{{WRAPPER}} .gform_previous_button.button:focus' => 'color: {{VALUE}};',
810
+ ],
811
+ ]
812
+ );
813
+
814
+ $this->add_control(
815
+ 'page_break_hover_bg_color',
816
+ [
817
+ 'label' => __( 'Background Color', 'happy-elementor-addons' ),
818
+ 'type' => Controls_Manager::COLOR,
819
+ 'selectors' => [
820
+ '{{WRAPPER}} .gform_next_button.button:hover' => 'background-color: {{VALUE}};',
821
+ '{{WRAPPER}} .gform_next_button.button:focus' => 'background-color: {{VALUE}};',
822
+ '{{WRAPPER}} .gform_previous_button.button:hover' => 'background-color: {{VALUE}};',
823
+ '{{WRAPPER}} .gform_previous_button.button:focus' => 'background-color: {{VALUE}};',
824
+ ],
825
+ ]
826
+ );
827
+
828
+ $this->add_control(
829
+ 'page_break_hover_border_color',
830
+ [
831
+ 'label' => __( 'Border Color', 'happy-elementor-addons' ),
832
+ 'type' => Controls_Manager::COLOR,
833
+ 'selectors' => [
834
+ '{{WRAPPER}} .gform_next_button.button:hover' => 'border-color: {{VALUE}};',
835
+ '{{WRAPPER}} .gform_next_button.button:focus' => 'border-color: {{VALUE}};',
836
+ '{{WRAPPER}} .gform_previous_button.button:hover' => 'border-color: {{VALUE}};',
837
+ '{{WRAPPER}} .gform_previous_button.button:focus' => 'border-color: {{VALUE}};',
838
+ ],
839
+ ]
840
+ );
841
+
842
+ $this->end_controls_tab();
843
+ $this->end_controls_tabs();
844
+
845
+ $this->end_controls_section();
846
+
847
+ $this->start_controls_section(
848
+ 'repeater_list',
849
+ [
850
+ 'label' => __( 'List', 'happy-elementor-addons' ),
851
+ 'tab' => Controls_Manager::TAB_STYLE,
852
+ ]
853
+ );
854
+
855
+ $this->add_responsive_control(
856
+ 'list_button_size',
857
+ [
858
+ 'label' => __( 'Button Size', 'happy-elementor-addons' ),
859
+ 'type' => Controls_Manager::SLIDER,
860
+ 'size_units' => [ 'px' ],
861
+ 'default' => [
862
+ 'unit' => 'px',
863
+ 'size' => 16,
864
+ ],
865
+ 'range' => [
866
+ 'px' => [
867
+ 'min' => 5,
868
+ 'max' => 50,
869
+ ]
870
+ ],
871
+ 'selectors' => [
872
+ '{{WRAPPER}} .gfield_list .gfield_list_icons img' => 'width: {{SIZE}}{{UNIT}} !important;',
873
+ ],
874
+ ]
875
+ );
876
+
877
+ $this->add_control(
878
+ 'list_even_background_color',
879
+ [
880
+ 'label' => __( 'Background Color (Even)', 'happy-elementor-addons' ),
881
+ 'type' => Controls_Manager::COLOR,
882
+ 'selectors' => [
883
+ '{{WRAPPER}} .gfield_list .gfield_list_row_even td' => 'background-color: {{VALUE}};',
884
+ ],
885
+ ]
886
+ );
887
+
888
+ $this->add_control(
889
+ 'list_odd_background_color',
890
+ [
891
+ 'label' => __( 'Background Color (Odd)', 'happy-elementor-addons' ),
892
+ 'type' => Controls_Manager::COLOR,
893
+ 'selectors' => [
894
+ '{{WRAPPER}} .gfield_list .gfield_list_row_odd td' => 'background-color: {{VALUE}};',
895
+ ],
896
+ ]
897
+ );
898
+
899
+ $this->end_controls_section();
900
+ }
901
+
902
+ protected function render() {
903
+ if ( ! ha_is_gravityforms_activated() ) {
904
+ return;
905
+ }
906
+
907
+ $settings = $this->get_settings_for_display();
908
+
909
+ if ( ! empty( $settings['form_id'] ) ) {
910
+ gravity_form( $settings['form_id'], $settings['form_title_show'] );
911
+ }
912
+ }
913
+ }
widgets/weform/widget.php CHANGED
@@ -128,7 +128,7 @@ class WeForm extends Base {
128
  ],
129
  ],
130
  'selectors' => [
131
- '{{WRAPPER}} .wpuf-form > li.wpuf-el.field-size-large > .wpuf-fields input' => 'width: {{SIZE}}{{UNIT}};',
132
  '{{WRAPPER}} .wpuf-form > li.wpuf-el.field-size-large > .wpuf-fields textarea' => 'width: {{SIZE}}{{UNIT}};',
133
 
134
  ],
@@ -617,7 +617,81 @@ class WeForm extends Base {
617
  $this->end_controls_tabs();
618
 
619
  $this->end_controls_section();
620
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
 
622
  protected function render() {
623
  if ( ! ha_is_weforms_activated() ) {
128
  ],
129
  ],
130
  'selectors' => [
131
+ '{{WRAPPER}} .wpuf-form > li.wpuf-el.field-size-large > .wpuf-fields input:not([type=radio]):not([type=checkbox])' => 'width: {{SIZE}}{{UNIT}};',
132
  '{{WRAPPER}} .wpuf-form > li.wpuf-el.field-size-large > .wpuf-fields textarea' => 'width: {{SIZE}}{{UNIT}};',
133
 
134
  ],
617
  $this->end_controls_tabs();
618
 
619
  $this->end_controls_section();
620
+
621
+ $this->start_controls_section(
622
+ 'section_break',
623
+ [
624
+ 'label' => __( 'Section Break', 'happy-elementor-addons' ),
625
+ 'tab' => Controls_Manager::TAB_STYLE,
626
+ ]
627
+ );
628
+
629
+ $this->add_group_control(
630
+ Group_Control_Typography::get_type(),
631
+ [
632
+ 'name' => 'break_title_typography',
633
+ 'label' => __( 'Title Typography', 'happy-elementor-addons' ),
634
+ 'selector' => '{{WRAPPER}} .section_break .wpuf-section-title',
635
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_2
636
+ ]
637
+ );
638
+
639
+ $this->add_group_control(
640
+ Group_Control_Typography::get_type(),
641
+ [
642
+ 'name' => 'break_description_typography',
643
+ 'label' => __( 'Description Typography', 'happy-elementor-addons' ),
644
+ 'selector' => '{{WRAPPER}} .section_break .wpuf-section-details',
645
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_4
646
+ ]
647
+ );
648
+
649
+ $this->start_controls_tabs( 'tabs_section_break_style' );
650
+
651
+ $this->start_controls_tab(
652
+ 'tab_break_title',
653
+ [
654
+ 'label' => __( 'Title', 'happy-elementor-addons' ),
655
+ ]
656
+ );
657
+
658
+ $this->add_control(
659
+ 'break_title_color',
660
+ [
661
+ 'label' => __( 'Color', 'happy-elementor-addons' ),
662
+ 'type' => Controls_Manager::COLOR,
663
+ 'selectors' => [
664
+ '{{WRAPPER}} .section_break .wpuf-section-title' => 'color: {{VALUE}};',
665
+ ],
666
+ ]
667
+ );
668
+
669
+ $this->end_controls_tab();
670
+
671
+ $this->start_controls_tab(
672
+ 'tab_break_description',
673
+ [
674
+ 'label' => __( 'Description', 'happy-elementor-addons' ),
675
+ ]
676
+ );
677
+
678
+ $this->add_control(
679
+ 'break_description_color',
680
+ [
681
+ 'label' => __( 'Color', 'happy-elementor-addons' ),
682
+ 'type' => Controls_Manager::COLOR,
683
+ 'selectors' => [
684
+ '{{WRAPPER}} .section_break .wpuf-section-details' => 'color: {{VALUE}};',
685
+ ],
686
+ ]
687
+ );
688
+
689
+ $this->end_controls_tab();
690
+ $this->end_controls_tabs();
691
+
692
+ $this->end_controls_section();
693
+
694
+ }
695
 
696
  protected function render() {
697
  if ( ! ha_is_weforms_activated() ) {