PluginProbe ʕ •ᴥ•ʔ
Happy Addons for Elementor / 3.21.4
Happy Addons for Elementor v3.21.4
3.21.4 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.18.0 2.19.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.21.0 2.21.1 2.22.0 2.22.1 2.23.0 2.24.0 2.24.1 2.25.0 2.26.0 2.27.0 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0 2.8.1 2.9.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.10.2 3.10.3 3.10.4 3.10.5 3.10.6 3.10.7 3.10.8 3.10.9 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 3.12.1 3.12.2 3.12.3 3.12.4 3.12.5 3.12.6 3.13.0 3.14.0 3.14.1 3.15.0 3.15.1 3.15.2 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.18.0 3.18.1 3.19.0 3.2.1 3.2.2 3.20.0 3.20.1 3.20.2 3.20.3 3.20.4 3.20.6 3.20.7 3.20.8 3.21.0 3.21.1 3.21.2 3.21.3 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.7.2 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.9.0 3.9.1 3.9.1.1 0.0.1 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.1 1.2.0 1.2.1 1.3.0 1.3.1 1.4.0 1.4.1 1.5.0 2.0.0 2.1.0 2.10.0 2.11.0 2.11.1 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 trunk
happy-elementor-addons / extensions / grid-layer.php
happy-elementor-addons / extensions Last commit date
advanced-tooltip.php 1 year ago background-overlay.php 1 year ago background-parallax.php 9 months ago column-extended.php 1 year ago css-transform.php 1 year ago custom-js.php 5 months ago custom-mouse-cursor.php 5 months ago equal-height.php 1 year ago fixed-size-button.php 10 months ago floating-effects.php 1 year ago grid-layer.php 1 year ago reading-progress-bar-kit-settings.php 1 year ago reading-progress-bar.php 1 year ago scroll-to-top-kit-settings.php 1 year ago scroll-to-top.php 1 year ago shape-divider.php 9 months ago text-stroke.php 10 months ago walker-nav-menu.php 1 year ago wrapper-link.php 1 year ago
grid-layer.php
244 lines
1 <?php
2 namespace Happy_Addons\Elementor\Extensions;
3
4 use Elementor\Controls_Manager;
5
6 defined( 'ABSPATH' ) || die();
7
8 class Grid_Layer {
9
10 private static $instance = null;
11
12 public static function instance() {
13 if ( is_null( self::$instance ) ) {
14 self::$instance = new self();
15 }
16 return self::$instance;
17 }
18
19 public static function add_controls_section( $element ) {
20 $element->start_controls_section(
21 '_section_happy_grid_layer',
22 [
23 'label' => __( 'Grid Layer', 'happy-elementor-addons' ) . ha_get_section_icon(),
24 'tab' => Controls_Manager::TAB_SETTINGS,
25 ]
26 );
27
28 $element->add_control(
29 'ha_grid',
30 [
31 'label' => __( 'Grid Layer', 'happy-elementor-addons' ),
32 'description' => __( 'Use "Cmd/Ctrl + Shift + G" to On/Off Grid Layer', 'happy-elementor-addons' ),
33 'type' => Controls_Manager::SWITCHER,
34 'label_on' => __( 'On', 'happy-elementor-addons' ),
35 'label_off' => __( 'Off', 'happy-elementor-addons' ),
36 'return_value' => 'yes',
37 'default' => '',
38 ]
39 );
40
41 $element->add_control(
42 '_grid_layer_notice',
43 [
44 'type' => Controls_Manager::RAW_HTML,
45 'raw' => __( 'This feature is avilable only in editor and only for design purpose.', 'happy-elementor-addons' ),
46 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
47 'condition' => [
48 'ha_grid' => 'yes',
49 ],
50 ]
51 );
52
53 $element->add_responsive_control(
54 'ha_grid_number',
55 [
56 'label' => __( 'Columns', 'happy-elementor-addons' ),
57 'type' => Controls_Manager::NUMBER,
58 'min' => 1,
59 'max' => 100,
60 'step' => 1,
61 'default' => 15,
62 'tablet_default' => 12,
63 'mobile_default' => 10,
64 'condition' => [
65 'ha_grid' => 'yes',
66 ],
67 'render_type' => 'none',
68 ]
69 );
70
71 $element->add_responsive_control(
72 'ha_grid_max_width',
73 [
74 'label' => __( 'Max Width', 'happy-elementor-addons' ),
75 'type' => Controls_Manager::SLIDER,
76 'size_units' => [ 'px', '%' ],
77 'range' => [
78 'px' => [
79 'min' => 0,
80 'max' => 3000,
81 'step' => 1,
82 ],
83 '%' => [
84 'min' => 0,
85 'max' => 100,
86 'step' => 0.1,
87 ],
88 ],
89 'default' => [
90 'unit' => '%',
91 'size' => 100,
92 ],
93 'condition' => [
94 'ha_grid' => 'yes',
95 ],
96 'render_type' => 'none',
97 ]
98 );
99
100 $element->add_responsive_control(
101 'ha_grid_offset',
102 [
103 'label' => __( 'Offset', 'happy-elementor-addons' ),
104 'type' => Controls_Manager::SLIDER,
105 'size_units' => [ 'px', '%' ],
106 'range' => [
107 'px' => [
108 'min' => 0,
109 'max' => 3000,
110 'step' => 1,
111 ],
112 '%' => [
113 'min' => 0,
114 'max' => 100,
115 'step' => 0.1,
116 ],
117 ],
118 'default' => [
119 'unit' => 'px',
120 'size' => 0,
121 ],
122 'condition' => [
123 'ha_grid' => 'yes',
124 ],
125 'render_type' => 'none',
126 ]
127 );
128
129 $element->add_responsive_control(
130 'ha_grid_gutter',
131 [
132 'label' => __( 'Gutter', 'happy-elementor-addons' ),
133 'type' => Controls_Manager::SLIDER,
134 'size_units' => [ 'px', '%' ],
135 'range' => [
136 'px' => [
137 'min' => 0,
138 'max' => 200,
139 'step' => 1,
140 ],
141 '%' => [
142 'min' => 0,
143 'max' => 100,
144 'step' => 0.1,
145 ],
146 ],
147 'default' => [
148 'unit' => 'px',
149 'size' => 15,
150 ],
151 'tablet_default' => [
152 'unit' => 'px',
153 'size' => 10,
154 ],
155 'mobile_default' => [
156 'unit' => 'px',
157 'size' => 5,
158 ],
159 'condition' => [
160 'ha_grid' => 'yes',
161 ],
162 'render_type' => 'none',
163 ]
164 );
165
166 $element->add_control(
167 'ha_grid_zindex',
168 [
169 'label' => __( 'Z-Index', 'happy-elementor-addons' ),
170 'type' => Controls_Manager::TEXT,
171 'input_type' => 'number',
172 'default' => '1000',
173 'condition' => [
174 'ha_grid' => 'yes',
175 ],
176 'render_type' => 'none',
177 ]
178 );
179
180 $element->add_control(
181 'ha_grid_color',
182 [
183 'label' => __( 'Grid Color', 'happy-elementor-addons' ),
184 'type' => Controls_Manager::COLOR,
185 'default' => 'rgba(226, 73, 138, 0.5)',
186 'condition' => [
187 'ha_grid' => 'yes',
188 ],
189 'render_type' => 'none',
190 ]
191 );
192
193 $element->add_control(
194 'ha_grid_on',
195 [
196 'label' => __( 'Grid Layer On', 'happy-elementor-addons' ),
197 'type' => Controls_Manager::HIDDEN,
198 'default' => 'grid-on',
199 'condition' => [
200 'ha_grid' => 'yes',
201 ],
202 'selectors' => [
203 'html.elementor-html' => 'position: relative;',
204 'html.elementor-html::before' => 'content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin-right: auto; margin-left: auto; pointer-events: none; z-index: {{ha_grid_zindex.VALUE || 1000}}; min-height: 100vh;',
205 //Desktop view
206 '(desktop) html.elementor-html::before' => '
207 width: calc(100% - (2 * {{ha_grid_offset.SIZE}}{{ha_grid_offset.UNIT}}));
208 max-width: {{ha_grid_max_width.SIZE}}{{ha_grid_max_width.UNIT}};
209 background-size: calc(100% + {{ha_grid_gutter.SIZE}}{{ha_grid_gutter.UNIT}}) 100%;
210 background-image: -webkit-repeating-linear-gradient( left, {{ha_grid_color.VALUE}}, {{ha_grid_color.VALUE}} calc((100% / {{ha_grid_number.VALUE}}) - {{ha_grid_gutter.SIZE}}{{ha_grid_gutter.UNIT}}), transparent calc((100% / {{ha_grid_number.VALUE}}) - {{ha_grid_gutter.SIZE}}{{ha_grid_gutter.UNIT}}), transparent calc(100% / {{ha_grid_number.VALUE}}) );
211 background-image: repeating-linear-gradient( to right, {{ha_grid_color.VALUE}}, {{ha_grid_color.VALUE}} calc((100% / {{ha_grid_number.VALUE}}) - {{ha_grid_gutter.SIZE}}{{ha_grid_gutter.UNIT}}), transparent calc((100% / {{ha_grid_number.VALUE}}) - {{ha_grid_gutter.SIZE}}{{ha_grid_gutter.UNIT}}), transparent calc(100% / {{ha_grid_number.VALUE}}) );',
212 //Tablet view
213 '(tablet) html.elementor-html::before' => '
214 width: calc(100% - (2 * {{ha_grid_offset_tablet.SIZE}}{{ha_grid_offset_tablet.UNIT}}));
215 max-width: {{ha_grid_max_width_tablet.SIZE}}{{ha_grid_max_width_tablet.UNIT}};
216 background-size: calc(100% + {{ha_grid_gutter_tablet.SIZE}}{{ha_grid_gutter_tablet.UNIT}}) 100%;
217 background-image: -webkit-repeating-linear-gradient( left, {{ha_grid_color.VALUE}}, {{ha_grid_color.VALUE}} calc((100% / {{ha_grid_number_tablet.VALUE}}) - {{ha_grid_gutter_tablet.SIZE}}{{ha_grid_gutter_tablet.UNIT}}), transparent calc((100% / {{ha_grid_number_tablet.VALUE}}) - {{ha_grid_gutter_tablet.SIZE}}{{ha_grid_gutter_tablet.UNIT}}), transparent calc(100% / {{ha_grid_number_tablet.VALUE}}) );
218 background-image: repeating-linear-gradient( to right, {{ha_grid_color.VALUE}}, {{ha_grid_color.VALUE}} calc((100% / {{ha_grid_number_tablet.VALUE}}) - {{ha_grid_gutter_tablet.SIZE}}{{ha_grid_gutter_tablet.UNIT}}), transparent calc((100% / {{ha_grid_number_tablet.VALUE}}) - {{ha_grid_gutter_tablet.SIZE}}{{ha_grid_gutter_tablet.UNIT}}), transparent calc(100% / {{ha_grid_number_tablet.VALUE}}) );',
219 //Mobile view
220 '(mobile) html.elementor-html::before' => '
221 width: calc(100% - (2 * {{ha_grid_offset_mobile.SIZE}}{{ha_grid_offset_mobile.UNIT}}));
222 max-width: {{ha_grid_max_width_mobile.SIZE}}{{ha_grid_max_width_mobile.UNIT}};
223 background-size: calc(100% + {{ha_grid_gutter_mobile.SIZE}}{{ha_grid_gutter_mobile.UNIT}}) 100%;
224 background-image: -webkit-repeating-linear-gradient( left, {{ha_grid_color.VALUE}}, {{ha_grid_color.VALUE}} calc((100% / {{ha_grid_number_mobile.VALUE}}) - {{ha_grid_gutter_mobile.SIZE}}{{ha_grid_gutter_mobile.UNIT}}), transparent calc((100% / {{ha_grid_number_mobile.VALUE}}) - {{ha_grid_gutter_mobile.SIZE}}{{ha_grid_gutter_mobile.UNIT}}), transparent calc(100% / {{ha_grid_number_mobile.VALUE}}) );
225 background-image: repeating-linear-gradient( to right, {{ha_grid_color.VALUE}}, {{ha_grid_color.VALUE}} calc((100% / {{ha_grid_number_mobile.VALUE}}) - {{ha_grid_gutter_mobile.SIZE}}{{ha_grid_gutter_mobile.UNIT}}), transparent calc((100% / {{ha_grid_number_mobile.VALUE}}) - {{ha_grid_gutter_mobile.SIZE}}{{ha_grid_gutter_mobile.UNIT}}), transparent calc(100% / {{ha_grid_number_mobile.VALUE}}) );',
226 ],
227 ]
228 );
229
230 $element->end_controls_section();
231 }
232
233 public static function get_default_grid_value( $value = '' ) {
234 $default = [
235 'desktop' => get_option( 'elementor_container_width', 1140 ),
236 'tablet' => get_option( 'elementor_viewport_lg', 1025 ),
237 'mobile' => get_option( 'elementor_viewport_md', 768 ),
238 ];
239
240 return $default[$value];
241 }
242
243 }
244