PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 2.8.17 2.8.18 All 259 releases
wpfunnels / includes / core / widgets / elementor / controls / optin-styles.php

optin-styles.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.1, at includes/core/widgets/elementor/controls/optin-styles.php

121 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Opt-in style
4 *
5 * @package WPFunnels\Widgets\Elementor\Controls
6 */
7 namespace WPFunnels\Widgets\Elementor\Controls;
8
9 use Composer\Installers\Plugin;
10 use Elementor\Controls_Stack;
11
12 if (! defined('ABSPATH')) {
13 exit; // Exit if accessed directly.
14 }
15
16 /**
17 * Elementor select2 control.
18 *
19 * A base control for creating select2 control. Displays a select box control
20 * based on select2 jQuery plugin @see https://select2.github.io/ .
21 * It accepts an array in which the `key` is the value and the `value` is the
22 * option name. Set `multiple` to `true` to allow multiple value selection.
23 *
24 * @since 1.0.0
25 */
26 class Optin_Styles extends \Elementor\Base_Data_Control
27 {
28
29 /**
30 * Get select2 control type.
31 *
32 * Retrieve the control type, in this case `select2`.
33 *
34 * @since 1.0.0
35 * @access public
36 *
37 * @return string Control type.
38 */
39 public function get_type()
40 {
41 return 'optin_styles';
42 }
43
44 /**
45 * Get select2 control default settings.
46 *
47 * Retrieve the default settings of the select2 control. Used to return the
48 * default settings while initializing the select2 control.
49 *
50 * @since 1.8.0
51 * @access protected
52 *
53 * @return array Control default settings.
54 */
55 protected function get_default_settings()
56 {
57 return [];
58 }
59
60
61 /**
62 * Enqueue emoji one area control scripts and styles.
63 *
64 * Used to register and enqueue custom scripts and styles used by the emoji one
65 * area control.
66 *
67 * @since 1.0.0
68 * @access public
69 */
70 public function enqueue()
71 {
72 wp_register_script('optin-style-control', WPFNL_URL.'includes/core/widgets/elementor/controls/assets/js/optin-styles.js', [ 'jquery' ], WPFNL_VERSION);
73 wp_enqueue_script('optin-style-control');
74 }
75
76
77 private function get_styles() {
78 return array(
79 'form-style1' => array(
80 'label' => 'Style 1',
81 'image' => WPFNL_URL.'/includes/core/widgets/elementor/assets/images/styles/style-1.png'
82 ),
83 'form-style2' => array(
84 'label' => 'Style 2',
85 'image' => WPFNL_URL.'/includes/core/widgets/elementor/assets/images/styles/style-2.png'
86 ),
87 );
88 }
89
90
91 /**
92 * Render select2 control output in the editor.
93 *
94 * Used to generate the control HTML in the editor using Underscore JS
95 * template. The variables for the class are available using `data` JS
96 * object.
97 *
98 * @since 1.0.0
99 * @access public
100 */
101 public function content_template()
102 {
103 $styles = $this->get_styles();
104
105 ?>
106
107 <# console.log('Event', data); #>
108 <div class="elementor-control-structure-presets">
109 <?php foreach ($styles as $key => $style){ ?>
110 <div class="single-style">
111 <input id="<?php echo $key; ?>" type="radio" name="elementor-control-structure-preset-{{ data._cid }}" data-setting="structure" value="<?php echo $key; ?>">
112 <label for="<?php echo $key; ?>" class="elementor-control-structure-preset">
113 <img src="<?php echo $style['image']; ?>"/>
114 </label>
115 <div class="elementor-control-structure-preset-title"></div>
116 </div>
117 <?php } ?>
118 </div>
119 <?php }
120 }
121