PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.1.0
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.1.0
4.11.79 4.11.78 4.11.77 4.11.76 4.11.75 3.20.5 4.11.69 3.20.6 4.11.7 3.20.7 4.11.70 3.20.8 4.11.71 3.20.9 4.11.72 3.21.1 4.11.73 3.21.2 4.11.74 3.21.3 4.11.8 3.21.4 4.11.9 3.21.5 4.2.0 3.21.6 4.2.1 3.3.0 4.2.2 3.3.1 4.2.3 3.3.2 4.2.4 3.3.3 4.2.5 3.3.4 4.2.6 3.3.5 4.2.7 3.3.6 4.2.8 3.3.7 4.2.9 3.3.8 4.3.0 3.3.9 4.3.1 3.4.0 4.3.2 3.4.1 4.3.3 3.4.2 4.3.4 3.4.3 4.3.5 3.4.4 4.3.6 3.4.5 4.3.7 3.4.6 4.3.8 3.4.7 4.3.9 3.4.8 4.4.0 3.4.9 4.4.1 3.5.0 4.4.2 3.5.1 4.4.3 3.5.2 4.4.4 3.5.3 4.4.5 3.5.4 4.4.6 3.5.5 4.4.7 3.5.6 4.4.8 3.5.7 4.4.9 3.5.8 4.5.0 3.5.9 4.5.1 3.6.0 4.5.2 3.6.1 4.5.3 3.6.2 4.5.4 3.6.3 4.5.5 3.6.4 4.5.6 3.6.5 4.5.7 3.6.6 4.5.8 3.6.7 4.5.9 3.6.8 4.6.0 3.6.9 4.6.1 3.7.0 4.7.0 3.7.1 4.7.1 3.7.2 4.7.2 3.7.3 4.7.3 3.7.4 4.7.4 3.7.5 4.7.5 3.7.6 4.7.6 3.7.7 4.7.7 3.7.8 4.7.8 3.7.9 4.7.9 3.8.0 4.8.0 3.8.1 4.8.1 3.8.2 4.8.10 3.8.3 4.8.11 3.8.4 4.8.2 3.8.5 4.8.3 3.8.6 4.8.4 3.8.7 4.8.5 3.8.8 4.8.6 3.8.9 4.8.7 3.9.0 4.8.8 3.9.1 4.8.9 3.9.2 4.9.0 3.9.3 4.9.0-beta1 3.9.4 4.9.0-beta2 3.9.5 4.9.1 3.9.6 4.9.10 3.9.7 4.9.11 3.9.8 4.9.12 3.9.9 4.9.13 4.0.1 4.9.14 4.0.3 4.9.15 4.0.4 4.9.16 4.0.5 4.9.17 4.0.6 4.9.18 4.0.7 4.9.19 4.0.8 4.9.2 4.0.9 4.9.20 4.1.0 4.9.21 4.1.1 4.9.22 4.1.2 4.9.23 4.1.3 4.9.24 trunk 4.1.4 4.9.25 1.0 4.1.5 4.9.26 1.01 4.1.6 4.9.27 1.02 4.1.7 4.9.28 1.03 4.1.8 4.9.29 1.04 4.1.9 4.9.3 1.05 4.10.0 4.9.30 1.06 4.10.1 4.9.31 1.07 4.10.10 4.9.32 1.08 4.10.11 4.9.33 1.09 4.10.12 4.9.34 2.0 4.10.13 4.9.35 2.0.1 4.10.14 4.9.36 2.0.2 4.10.15 4.9.37 2.0.3 4.10.16 4.9.38 2.0.4 4.10.17 4.9.39 2.0.5 4.10.18 4.9.4 2.0.6 4.10.19 4.9.40 2.0.7 4.10.2 4.9.41 2.0.8 4.10.20 4.9.42 2.0.9 4.10.21 4.9.43 2.1.0 4.10.22 4.9.45 2.1.1 4.10.23 4.9.46 2.1.2 4.10.24 4.9.47 2.1.3 4.10.25 4.9.48 2.1.4 4.10.26 4.9.49 2.1.5 4.10.27 4.9.5 2.1.5-beta1 4.10.28 4.9.50 2.1.6 4.10.29 4.9.51 2.1.7 4.10.3 4.9.52 2.1.8 4.10.30 4.9.53 2.1.9 4.10.31 4.9.54 2.2.0 4.10.32 4.9.55 2.2.1 4.10.33 4.9.56 2.2.2 4.10.34 4.9.57 2.2.3 4.10.35 4.9.6 2.2.4 4.10.36 4.9.7 2.2.5 4.10.37 4.9.8 2.2.6 4.10.38 4.9.9 2.2.7 4.10.39 2.2.8 4.10.4 2.2.9 4.10.40 2.3.0 4.10.41 2.3.1 4.10.42 2.3.2 4.10.43 2.3.3 4.10.44 2.3.4 4.10.45 2.3.5 4.10.46 2.3.6 4.10.47 2.3.7 4.10.48 2.3.8 4.10.49 2.3.9 4.10.5 2.4.0 4.10.50 2.4.1 4.10.51 2.5.0 4.10.52 2.5.1 4.10.53 2.5.2 4.10.54 2.5.3 4.10.55 2.5.4 4.10.56 2.5.5 4.10.57 2.5.6 4.10.58 2.5.7 4.10.59 2.5.8 4.10.6 2.5.9 4.10.60 2.6.0 4.10.61 2.6.1 4.10.62 2.6.2 4.10.63 2.6.3 4.10.64 2.6.4 4.10.65 2.6.5 4.10.66 2.6.6 4.10.67 2.6.7 4.10.68 2.6.8 4.10.69 2.6.9 4.10.7 2.7.0 4.10.70 2.7.1 4.10.71 2.7.2 4.10.72 2.7.3 4.10.73 2.7.4 4.10.74 2.7.5 4.10.75 2.7.6 4.10.76 2.7.7 4.10.77 2.7.8 4.10.78 2.7.9 4.10.79 2.8.0 4.10.8 2.8.1 4.10.80 2.8.2 4.10.81 2.8.3 4.10.82 2.8.4 4.10.83 2.8.5 4.10.84 2.8.6 4.10.85 2.8.7 4.10.86 2.8.8 4.10.87 2.8.9 4.10.88 2.9.0 4.10.89 2.9.1 4.10.9 2.9.2 4.10.90 2.9.3 4.11.0 2.9.4 4.11.1 2.9.5 4.11.10 2.9.6 4.11.11 2.9.7 4.11.12 2.9.8 4.11.13 2.9.9 4.11.14 3.0.0 4.11.15 3.0.1 4.11.16 3.0.2 4.11.17 3.0.3 4.11.18 3.0.4 4.11.19 3.0.5 4.11.2 3.0.6 4.11.20 3.0.7 4.11.21 3.0.8 4.11.22 3.0.9 4.11.23 3.1.0 4.11.24 3.1.1 4.11.25 3.1.2 4.11.26 3.1.3 4.11.27 3.1.4 4.11.28 3.1.5 4.11.29 3.1.6 4.11.3 3.1.7 4.11.30 3.1.8 4.11.31 3.1.9 4.11.32 3.10.0 4.11.33 3.10.1 4.11.34 3.10.2 4.11.35 3.10.3 4.11.36 3.10.4 4.11.37 3.10.5 4.11.38 3.10.6 4.11.39 3.10.7 4.11.4 3.10.8 4.11.40 3.10.9 4.11.41 3.11.0 4.11.42 3.11.1 4.11.43 3.11.2 4.11.44 3.11.3 4.11.45 3.11.4 4.11.46 3.11.5 4.11.47 3.11.6 4.11.48 3.11.7 4.11.49 3.11.8 4.11.5 3.11.9 4.11.50 3.12.0 4.11.51 3.12.1 4.11.52 3.12.2 4.11.53 3.12.3 4.11.54 3.2.0 4.11.55 3.2.1 4.11.56 3.2.2 4.11.57 3.2.3 4.11.58 3.2.4 4.11.59 3.2.5 4.11.6 3.2.6 4.11.60 3.2.7 4.11.61 3.2.8 4.11.62 3.2.9 4.11.63 3.20.0 4.11.64 3.20.1 4.11.65 3.20.2 4.11.66 3.20.3 4.11.67 3.20.4 4.11.68
premium-addons-for-elementor / widgets / premium-grid.php
premium-addons-for-elementor / widgets Last commit date
dep 5 years ago premium-banner.php 5 years ago premium-blog.php 5 years ago premium-button.php 5 years ago premium-carousel.php 5 years ago premium-contactform.php 5 years ago premium-countdown.php 5 years ago premium-counter.php 5 years ago premium-dual-header.php 5 years ago premium-fancytext.php 5 years ago premium-grid.php 5 years ago premium-icon-list.php 5 years ago premium-image-button.php 5 years ago premium-image-scroll.php 5 years ago premium-image-separator.php 5 years ago premium-lottie.php 5 years ago premium-maps.php 5 years ago premium-modalbox.php 5 years ago premium-person.php 5 years ago premium-pricing-table.php 5 years ago premium-progressbar.php 5 years ago premium-testimonials.php 5 years ago premium-title.php 5 years ago premium-videobox.php 5 years ago premium-vscroll.php 5 years ago
premium-grid.php
2804 lines
1 <?php
2
3 /**
4 * Premium Media Grid.
5 */
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Modules\DynamicTags\Module as TagsModule;
10 use Elementor\Widget_Base;
11 use Elementor\Utils;
12 use Elementor\Embed;
13 use Elementor\Control_Media;
14 use Elementor\Controls_Manager;
15 use Elementor\Icons_Manager;
16 use Elementor\Repeater;
17 use Elementor\Scheme_Color;
18 use Elementor\Scheme_Typography;
19 use Elementor\Group_Control_Border;
20 use Elementor\Group_Control_Typography;
21 use Elementor\Group_Control_Css_Filter;
22 use Elementor\Group_Control_Text_Shadow;
23 use Elementor\Group_Control_Box_Shadow;
24 use Elementor\Group_Control_Background;
25 use Elementor\Group_Control_Image_Size;
26
27 // PremiumAddons Classes.
28 use PremiumAddons\Includes\Helper_Functions;
29 use PremiumAddons\Includes\Premium_Template_Tags;
30
31 if( ! defined( 'ABSPATH' ) ) exit;
32
33 /**
34 * Class Premium_Grid
35 */
36 class Premium_Grid extends Widget_Base {
37
38 public function get_name() {
39 return 'premium-img-gallery';
40 }
41
42 public function getTemplateInstance() {
43 return $this->templateInstance = Premium_Template_Tags::getInstance();
44 }
45
46 public function get_title() {
47 return sprintf( '%1$s %2$s', Helper_Functions::get_prefix(), __('Media Grid', 'premium-addons-for-elementor') );
48 }
49
50 public function get_icon() {
51 return 'pa-grid-icon';
52 }
53
54 public function get_style_depends() {
55 return [
56 'pa-prettyphoto',
57 'premium-addons'
58 ];
59 }
60
61 public function get_script_depends() {
62 return [
63 'prettyPhoto-js',
64 'isotope-js',
65 'premium-addons'
66 ];
67 }
68
69 public function is_reload_preview_required() {
70 return true;
71 }
72
73 public function get_categories() {
74 return ['premium-elements'];
75 }
76
77 public function get_keywords() {
78 return ['layout', 'gallery', 'images', 'videos', 'portfolio', 'visual', 'masonry'];
79 }
80
81 public function get_custom_help_url() {
82 return 'https://premiumaddons.com/support/';
83 }
84
85 /**
86 * Register Media Grid controls.
87 *
88 * @since 2.1.0
89 * @access protected
90 */
91 protected function _register_controls() {
92
93 $this->start_controls_section('premium_gallery_general',
94 [
95 'label' => __('Layout','premium-addons-for-elementor'),
96
97 ]);
98
99 $this->add_control('premium_gallery_img_size_select',
100 [
101 'label' => __('Grid Layout', 'premium-addons-for-elementor'),
102 'type' => Controls_Manager::SELECT,
103 'options' => [
104 'fitRows' => __('Even', 'premium-addons-for-elementor'),
105 'masonry' => __('Masonry', 'premium-addons-for-elementor'),
106 'metro' => __('Metro', 'premium-addons-for-elementor'),
107 ],
108 'default' => 'fitRows',
109 ]
110 );
111
112 $this->add_responsive_control('pemium_gallery_even_img_height',
113 [
114 'label' => __( 'Height', 'premium-addons-for-elementor' ),
115 'label_block' => true,
116 'size_units' => ['px', 'em', 'vh'],
117 'type' => Controls_Manager::SLIDER,
118 'range' => [
119 'px' => [
120 'min' => 1,
121 'max' => 500,
122 ],
123 'em' => [
124 'min' => 1,
125 'max' => 50,
126 ],
127 ],
128 'render_type' => 'template',
129 'condition' => [
130 'premium_gallery_img_size_select' => 'fitRows'
131 ],
132 'selectors' => [
133 '{{WRAPPER}} .premium-gallery-item .pa-gallery-image' => 'height: {{SIZE}}{{UNIT}}'
134 ]
135 ]
136 );
137
138 $this->add_control('premium_gallery_images_fit',
139 [
140 'label' => __('Images Fit', 'premium-addons-for-elementor'),
141 'type' => Controls_Manager::SELECT,
142 'options' => [
143 'fill' => __('Fill', 'premium-addons-for-elementor'),
144 'cover' => __('Cover', 'premium-addons-for-elementor'),
145 ],
146 'default' => 'fill',
147 'selectors' => [
148 '{{WRAPPER}} .premium-gallery-item .pa-gallery-image' => 'object-fit: {{VALUE}}'
149 ],
150 'condition' => [
151 'premium_gallery_img_size_select' => [ 'metro', 'fitRows' ]
152 ]
153 ]
154 );
155
156 $this->add_group_control(
157 Group_Control_Image_Size::get_type(),
158 [
159 'name' => 'thumbnail',
160 'default' => 'full',
161 ]
162 );
163
164 $this->add_responsive_control('premium_gallery_column_number',
165 [
166 'label' => __( 'Columns', 'premium-addons-for-elementor' ),
167 'label_block' => true,
168 'type' => Controls_Manager::SELECT,
169 'desktop_default' => '50%',
170 'tablet_default' => '100%',
171 'mobile_default' => '100%',
172 'options' => [
173 '100%' => __( '1 Column', 'premium-addons-for-elementor' ),
174 '50%' => __( '2 Columns', 'premium-addons-for-elementor' ),
175 '33.330%' => __( '3 Columns', 'premium-addons-for-elementor' ),
176 '25%' => __( '4 Columns', 'premium-addons-for-elementor' ),
177 '20%' => __( '5 Columns', 'premium-addons-for-elementor' ),
178 '16.66%' => __( '6 Columns', 'premium-addons-for-elementor' ),
179 '8.33%' => __( '12 Columns', 'premium-addons-for-elementor' ),
180 ],
181 'condition' => [
182 'premium_gallery_img_size_select!' => 'metro'
183 ],
184 'selectors' => [
185 '{{WRAPPER}} .premium-img-gallery-masonry div.premium-gallery-item, {{WRAPPER}} .premium-img-gallery-fitRows div.premium-gallery-item' => 'width: {{VALUE}};',
186 ],
187 'render_type' => 'template'
188 ]
189 );
190
191 $this->add_control( 'premium_gallery_load_more',
192 [
193 'label' => __( 'Load More Button', 'premium-addons-for-elementor' ),
194 'description' => __('Requires number of images larger than 6', 'premium-addons-for-elementor'),
195 'type' => Controls_Manager::SWITCHER
196 ]
197 );
198
199 $this->add_control( 'premium_gallery_load_more_text',
200 [
201 'label' => __( 'Button Text', 'premium-addons-for-elementor' ),
202 'type' => Controls_Manager::TEXT,
203 'default' => __('Load More', 'premium-addons-for-elementor'),
204 'dynamic' => [ 'active' => true ],
205 'condition' => [
206 'premium_gallery_load_more' => 'yes'
207 ]
208 ]
209 );
210
211 $this->add_control( 'premium_gallery_load_minimum',
212 [
213 'label' => __('Minimum Number of Images', 'premium-addons-for-elementor'),
214 'type' => Controls_Manager::NUMBER,
215 'description' => __('Set the minimum number of images before showing load more button', 'premium-addons-for-elementor'),
216 'default' => 6,
217 'condition' => [
218 'premium_gallery_load_more' => 'yes'
219 ]
220 ]
221 );
222
223 $this->add_control( 'premium_gallery_load_click_number',
224 [
225 'label' => __('Images to Show', 'premium-addons-for-elementor'),
226 'type' => Controls_Manager::NUMBER,
227 'description' => __('Set the minimum number of images to show with each click', 'premium-addons-for-elementor'),
228 'default' => 6,
229 'condition' => [
230 'premium_gallery_load_more' => 'yes'
231 ]
232 ]
233 );
234
235 $this->add_responsive_control('premium_gallery_load_more_align',
236 [
237 'label' => __( 'Button Alignment', 'premium-addons-for-elementor' ),
238 'type' => Controls_Manager::CHOOSE,
239 'options' => [
240 'left' => [
241 'title'=> __( 'Left', 'premium-addons-for-elementor' ),
242 'icon' => 'fa fa-align-left',
243 ],
244 'center' => [
245 'title'=> __( 'Center', 'premium-addons-for-elementor' ),
246 'icon' => 'fa fa-align-center',
247 ],
248 'right' => [
249 'title'=> __( 'Right', 'premium-addons-for-elementor' ),
250 'icon' => 'fa fa-align-right',
251 ],
252 ],
253 'default' => 'center',
254 'selectors' => [
255 '{{WRAPPER}} .premium-gallery-load-more' => 'text-align: {{VALUE}};',
256 ],
257 'condition' => [
258 'premium_gallery_load_more' => 'yes'
259 ]
260 ]
261 );
262
263 $this->end_controls_section();
264
265 $this->start_controls_section('premium_gallery_cats',
266 [
267 'label' => __('Categories','premium-addons-for-elementor'),
268 ]
269 );
270
271 $this->add_control('premium_gallery_filter',
272 [
273 'label' => __( 'Filter Tabs', 'premium-addons-for-elementor' ),
274 'type' => Controls_Manager::SWITCHER,
275 'default' => 'yes'
276 ]
277 );
278
279 $condition = array( 'premium_gallery_filter' => 'yes' );
280
281 $this->add_control( 'premium_gallery_first_cat_switcher',
282 [
283 'label' => __( 'First Category', 'premium-addons-for-elementor' ),
284 'type' => Controls_Manager::SWITCHER,
285 'default' => 'yes',
286 'condition' => $condition
287 ]
288 );
289
290 $this->add_control( 'premium_gallery_first_cat_label',
291 [
292 'label' => __( 'First Category Label', 'premium-addons-for-elementor' ),
293 'type' => Controls_Manager::TEXT,
294 'default' => __('All', 'premium-addons-for-elementor'),
295 'dynamic' => [ 'active' => true ],
296 'condition' => array_merge( [
297 'premium_gallery_first_cat_switcher' => 'yes'
298 ], $condition )
299 ]
300 );
301
302 $repeater = new REPEATER();
303
304 $repeater->add_control( 'premium_gallery_img_cat',
305 [
306 'label' => __( 'Category', 'premium-addons-for-elementor' ),
307 'type' => Controls_Manager::TEXT,
308 'dynamic' => [ 'active' => true ],
309 ]
310 );
311
312 $repeater->add_control( 'premium_gallery_img_cat_rotation',
313 [
314 'label' => __('Rotation Degrees', 'premium-addons-for-elementor'),
315 'type' => Controls_Manager::NUMBER,
316 'description' => __('Set rotation value in degrees', 'premium-addons-for-elementor'),
317 'min' => -180,
318 'max' => 180,
319 'selectors' => [
320 '{{WRAPPER}} {{CURRENT_ITEM}}' => 'transform: rotate({{VALUE}}deg);'
321 ],
322 ]
323 );
324
325 $this->add_control('premium_gallery_cats_content',
326 [
327 'label' => __( 'Categories', 'premium-addons-for-elementor' ),
328 'type' => Controls_Manager::REPEATER,
329 'default' => [
330 [
331 'premium_gallery_img_cat' => 'Category 1',
332 ],
333 [
334 'premium_gallery_img_cat' => 'Category 2',
335 ],
336 ],
337 'fields' => $repeater->get_controls(),
338 'title_field' => '{{{ premium_gallery_img_cat }}}',
339 'condition' => $condition
340 ]
341 );
342
343 $this->add_control('premium_gallery_active_cat',
344 [
345 'label' => __('Active Category Index', 'premium-addons-for-elementor'),
346 'type' => Controls_Manager::NUMBER,
347 'default' => 0,
348 'min' => 0,
349 'condition' => $condition
350
351 ]
352 );
353
354 $this->add_control('active_cat_notice',
355 [
356 'raw' => __( 'Please note categories are zero indexed, so if you need the first category to be active, you need to set the value to 0', 'premium-addons-for-elementor' ),
357 'type' => Controls_Manager::RAW_HTML,
358 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
359 ]
360 );
361
362 $this->add_control('premium_gallery_shuffle',
363 [
364 'label' => __( 'Shuffle Images on Filter Click', 'premium-addons-for-elementor' ),
365 'type' => Controls_Manager::SWITCHER,
366 'condition' => array_merge( [
367 'premium_gallery_filter' => 'yes'
368 ], $condition )
369 ]
370 );
371
372 $this->add_responsive_control('premium_gallery_filters_align',
373 [
374 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
375 'type' => Controls_Manager::CHOOSE,
376 'options' => [
377 'flex-start' => [
378 'title'=> __( 'Left', 'premium-addons-for-elementor' ),
379 'icon' => 'fa fa-align-left',
380 ],
381 'center' => [
382 'title'=> __( 'Center', 'premium-addons-for-elementor' ),
383 'icon' => 'fa fa-align-center',
384 ],
385 'flex-end' => [
386 'title'=> __( 'Right', 'premium-addons-for-elementor' ),
387 'icon' => 'fa fa-align-right',
388 ],
389 ],
390 'default' => 'center',
391 'selectors' => [
392 '{{WRAPPER}} .premium-img-gallery-filter' => 'justify-content: {{VALUE}}'
393 ],
394 'condition' => $condition
395 ]
396 );
397
398 $this->end_controls_section();
399
400 $this->start_controls_section('premium_gallery_content',
401 [
402 'label' => __('Images/Videos','premium-addons-for-elementor'),
403 ]);
404
405 $img_repeater = new REPEATER();
406
407 $img_repeater->add_control('premium_gallery_img',
408 [
409 'label' => __( 'Upload Image', 'premium-addons-for-elementor' ),
410 'type' => Controls_Manager::MEDIA,
411 'dynamic' => [ 'active' => true ],
412 'default' => [
413 'url' => Utils::get_placeholder_image_src(),
414 ],
415 ]);
416
417 $img_repeater->add_responsive_control('premium_gallery_image_cell',
418 [
419 'label' => __( 'Width', 'premium-addons-for-elementor' ),
420 'description' => __('Works only when layout set to Metro', 'premium-addons-for-elementor'),
421 'label_block' => true,
422 'default' => [
423 'unit' => 'px',
424 'size' => 4
425 ],
426 'type' => Controls_Manager::SLIDER,
427 'range' => [
428 'px' => [
429 'min' => 1,
430 'max' => 12,
431 ],
432 ],
433 'render_type' => 'template'
434 ]
435 );
436
437 $img_repeater->add_responsive_control('premium_gallery_image_vcell',
438 [
439 'label' => __( 'Height', 'premium-addons-for-elementor' ),
440 'description' => __('Works only when layout set to \'Metro\'', 'premium-addons-for-elementor'),
441 'label_block' => true,
442 'type' => Controls_Manager::SLIDER,
443 'default' => [
444 'unit' => 'px',
445 'size' => 4
446 ],
447 'range' => [
448 'px' => [
449 'min' => 1,
450 'max' => 12,
451 ],
452 ],
453 'render_type' => 'template'
454 ]
455 );
456
457 $img_repeater->add_control('premium_gallery_video',
458 [
459 'label' => __( 'Video', 'premium-addons-for-elementor' ),
460 'type' => Controls_Manager::SWITCHER,
461 'return_value' => 'true'
462 ]
463 );
464
465 $img_repeater->add_control('premium_gallery_video_type',
466 [
467 'label' => __( 'Type', 'premium-addons-for-elementor' ),
468 'type' => Controls_Manager::SELECT,
469 'options' => [
470 'youtube' => __('YouTube', 'premium-addons-for-elementor'),
471 'vimeo' => __('Vimeo', 'premium-addons-for-elementor'),
472 'hosted' => __('Self Hosted', 'premium-addons-for-elementor'),
473 ],
474 'label_block' => true,
475 'default' => 'youtube',
476 'condition' => [
477 'premium_gallery_video' => 'true',
478 ]
479 ]
480 );
481
482 $img_repeater->add_control('premium_gallery_video_url',
483 [
484 'label' => __( 'Video URL', 'premium-addons-for-elementor' ),
485 'type' => Controls_Manager::TEXT,
486 'label_block' => true,
487 'dynamic' => [
488 'active' => true,
489 'categories' => [
490 TagsModule::POST_META_CATEGORY,
491 TagsModule::URL_CATEGORY
492 ]
493 ],
494 'condition' => [
495 'premium_gallery_video' => 'true',
496 'premium_gallery_video_type!' => 'hosted'
497 ]
498 ]
499 );
500
501 $img_repeater->add_control('premium_gallery_video_self',
502 [
503 'label' => __('Select Video', 'premium-addons-for-elementor'),
504 'type' => Controls_Manager::MEDIA,
505 'dynamic' => [
506 'active' => true,
507 'categories' => [
508 TagsModule::POST_META_CATEGORY,
509 TagsModule::URL_CATEGORY,
510 ],
511 ],
512 'media_type' => 'video',
513 'condition' => [
514 'premium_gallery_video' => 'true',
515 'premium_gallery_video_type'=> 'hosted'
516 ]
517 ]
518 );
519
520 $img_repeater->add_control('premium_gallery_video_self_url',
521 [
522 'label' => __('Remote Video URL', 'premium-addons-for-elementor'),
523 'type' => Controls_Manager::TEXT,
524 'dynamic' => [
525 'active' => true,
526 ],
527 'label_block' => true,
528 'condition' => [
529 'premium_gallery_video' => 'true',
530 'premium_gallery_video_type'=> 'hosted'
531 ]
532 ]
533 );
534
535 $img_repeater->add_control('premium_gallery_video_controls',
536 [
537 'label' => __( 'Controls', 'premium-addons-for-elementor' ),
538 'type' => Controls_Manager::SWITCHER,
539 'return_value' => 'true',
540 'default' => 'true',
541 'condition' => [
542 'premium_gallery_video' => 'true'
543 ]
544 ]
545 );
546
547 $img_repeater->add_control('premium_gallery_video_mute',
548 [
549 'label' => __( 'Mute', 'premium-addons-for-elementor' ),
550 'type' => Controls_Manager::SWITCHER,
551 'return_value' => 'true',
552 'condition' => [
553 'premium_gallery_video' => 'true'
554 ]
555 ]
556 );
557
558 $img_repeater->add_control('premium_gallery_img_name',
559 [
560 'label' => __( 'Title', 'premium-addons-for-elementor' ),
561 'type' => Controls_Manager::TEXT,
562 'dynamic' => [ 'active' => true ],
563 'label_block' => true,
564 ]);
565
566 $img_repeater->add_control('premium_gallery_img_desc',
567 [
568 'label' => __( 'Description', 'premium-addons-for-elementor' ),
569 'type' => Controls_Manager::TEXTAREA,
570 'dynamic' => [ 'active' => true ],
571 'label_block' => true,
572 ]);
573
574 $img_repeater->add_control('premium_gallery_img_category',
575 [
576 'label' => __( 'Category', 'premium-addons-for-elementor' ),
577 'type' => Controls_Manager::TEXT,
578 'description'=> __('To assign for multiple categories, separate by a comma \',\'','premium-addons-for-elementor'),
579 'dynamic' => [ 'active' => true ],
580 ]);
581
582 $img_repeater->add_control('premium_gallery_img_link_type',
583 [
584 'label' => __('Link Type', 'premium-addons-for-elementor'),
585 'type' => Controls_Manager::SELECT,
586 'options' => [
587 'url' => __('URL', 'premium-addons-for-elementor'),
588 'link' => __('Existing Page', 'premium-addons-for-elementor'),
589 ],
590 'default' => 'url',
591 'label_block' => true,
592 'condition' => [
593 'premium_gallery_video!' => 'true',
594 ]
595 ]);
596
597 $img_repeater->add_control('premium_gallery_img_link',
598 [
599 'label' => __('Link', 'premium-addons-for-elementor'),
600 'type' => Controls_Manager::URL,
601 'dynamic' => [ 'active' => true ],
602 'placeholder' => 'https://premiumaddons.com/',
603 'label_block' => true,
604 'condition' => [
605 'premium_gallery_img_link_type' => 'url',
606 'premium_gallery_video!' => 'true',
607 ]
608 ]);
609
610 $img_repeater->add_control('premium_gallery_img_existing',
611 [
612 'label' => __('Existing Page', 'premium-addons-for-elementor'),
613 'type' => Controls_Manager::SELECT2,
614 'options' => $this->getTemplateInstance()->get_all_posts(),
615 'condition' => [
616 'premium_gallery_img_link_type'=> 'link',
617 ],
618 'multiple' => false,
619 'separator' => 'after',
620 'label_block' => true,
621 'condition' => [
622 'premium_gallery_img_link_type' => 'link',
623 'premium_gallery_video!' => 'true',
624 ]
625 ]);
626
627 $img_repeater->add_control('premium_gallery_link_whole',
628 [
629 'label' => __( 'Whole Image Link', 'premium-addons-for-elementor' ),
630 'type' => Controls_Manager::SWITCHER,
631 'condition' => [
632 'premium_gallery_video!' => 'true',
633 ]
634 ]
635 );
636
637 $img_repeater->add_control('premium_gallery_lightbox_whole',
638 [
639 'label' => __( 'Whole Image Lightbox', 'premium-addons-for-elementor' ),
640 'type' => Controls_Manager::SWITCHER,
641 'condition' => [
642 'premium_gallery_video!' => 'true',
643 ]
644 ]
645 );
646
647 $this->add_control('premium_gallery_img_content',
648 [
649 'label' => __( 'Images', 'premium-addons-for-elementor' ),
650 'type' => Controls_Manager::REPEATER,
651 'default' => [
652 [
653 'premium_gallery_img_name' => 'Image #1',
654 'premium_gallery_img_category' => 'Category 1'
655 ],
656 [
657 'premium_gallery_img_name' => 'Image #2',
658 'premium_gallery_img_category' => 'Category 2'
659 ],
660 ],
661 'fields' => $img_repeater->get_controls(),
662 'title_field' => '{{{ "" !== premium_gallery_img_name ? premium_gallery_img_name : "Image" }}}' . ' - {{{ "" !== premium_gallery_img_category ? premium_gallery_img_category : "No Categories" }}}',
663 ]
664 );
665
666 $this->add_control('premium_gallery_shuffle_onload',
667 [
668 'label' => __( 'Shuffle Images on Page Load', 'premium-addons-for-elementor' ),
669 'type' => Controls_Manager::SWITCHER,
670 ]
671 );
672
673 $this->add_control('premium_gallery_yt_thumbnail_size',
674 [
675 'label' => __( 'Youtube Videos Thumbnail Size', 'premium-addons-for-elementor' ),
676 'type' => Controls_Manager::SELECT,
677 'options' => [
678 'maxresdefault' => __( 'Maximum Resolution', 'premium-addons-for-elementor' ),
679 'hqdefault' => __( 'High Quality', 'premium-addons-for-elementor' ),
680 'mqdefault' => __( 'Medium Quality', 'premium-addons-for-elementor' ),
681 'sddefault' => __( 'Standard Quality', 'premium-addons-for-elementor' ),
682 ],
683 'default' => 'maxresdefault',
684 'label_block'=> true
685 ]
686 );
687
688 $this->end_controls_section();
689
690 $this->start_controls_section('premium_gallery_grid_settings',
691 [
692 'label' => __('Display Options','premium-addons-for-elementor'),
693
694 ]);
695
696 $this->add_responsive_control('premium_gallery_gap',
697 [
698 'label' => __('Image Gap', 'premium-addons-for-elementor'),
699 'type' => Controls_Manager::SLIDER,
700 'size_units' => ['px', '%', "em"],
701 'range' => [
702 'px' => [
703 'min' => 0,
704 'max' => 200,
705 ],
706 ],
707 'selectors' => [
708 '{{WRAPPER}} .premium-gallery-item' => 'padding: {{SIZE}}{{UNIT}}'
709 ]
710 ]
711 );
712
713 $this->add_control('premium_gallery_img_style',
714 [
715 'label' => __('Skin', 'premium-addons-for-elementor'),
716 'type' => Controls_Manager::SELECT,
717 'description' => __('Choose a layout style for the gallery','premium-addons-for-elementor'),
718 'options' => [
719 'default' => __('Style 1', 'premium-addons-for-elementor'),
720 'style1' => __('Style 2', 'premium-addons-for-elementor'),
721 'style2' => __('Style 3', 'premium-addons-for-elementor'),
722 'style3' => __('Style 4', 'premium-addons-for-elementor'),
723 ],
724 'default' => 'default',
725 'separator' => 'before',
726 'label_block' => true
727 ]
728 );
729
730 $this->add_control('premium_grid_style_notice',
731 [
732 'raw' => __('Style 4 works only with Even / Masonry Layout', 'premium-addons-for-elementor'),
733 'type' => Controls_Manager::RAW_HTML,
734 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
735 'condition' => [
736 'premium_gallery_img_style' => 'style3',
737 'premium_gallery_img_size_select' => 'metro'
738 ]
739 ]
740 );
741
742 $this->add_responsive_control('premium_gallery_style1_border_border',
743 [
744 'label' => __('Height', 'premium-addons-for-elementor'),
745 'type' => Controls_Manager::SLIDER,
746 'range' => [
747 'px' => [
748 'min' => 0,
749 'max' => 700,
750 ]
751 ],
752 'label_block' => true,
753 'selectors' => [
754 '{{WRAPPER}} .pa-gallery-img.style1 .premium-gallery-caption' => 'bottom: {{SIZE}}px;',
755 ],
756 'condition' => [
757 'premium_gallery_img_style' => 'style1'
758 ]
759 ]
760 );
761
762 $this->add_control('premium_gallery_img_effect',
763 [
764 'label' => __('Hover Effect', 'premium-addons-for-elementor'),
765 'type' => Controls_Manager::SELECT,
766 'description' => __('Choose a hover effect for the image','premium-addons-for-elementor'),
767 'options' => [
768 'none' => __('None', 'premium-addons-for-elementor'),
769 'zoomin' => __('Zoom In', 'premium-addons-for-elementor'),
770 'zoomout' => __('Zoom Out', 'premium-addons-for-elementor'),
771 'scale' => __('Scale', 'premium-addons-for-elementor'),
772 'gray' => __('Grayscale', 'premium-addons-for-elementor'),
773 'blur' => __('Blur', 'premium-addons-for-elementor'),
774 'bright' => __('Bright', 'premium-addons-for-elementor'),
775 'sepia' => __('Sepia', 'premium-addons-for-elementor'),
776 'trans' => __('Translate', 'premium-addons-for-elementor'),
777 ],
778 'default' => 'zoomin',
779 'label_block' => true,
780 'separator' => 'after'
781 ]
782 );
783
784 $this->add_control('premium_gallery_links_icon',
785 [
786 'label' => __( 'Links Icon', 'premium-addons-for-elementor' ),
787 'type' => Controls_Manager::ICONS,
788 'default' => [
789 'library' => 'fa-solid',
790 'value' => 'fas fa-link',
791 ]
792 ]
793 );
794
795 $this->add_control('premium_gallery_videos_heading',
796 [
797 'label' => __( 'Videos', 'premium-addons-for-elementor' ),
798 'type' => Controls_Manager::HEADING,
799 'separator' => 'before'
800 ]
801 );
802
803 $this->add_control('premium_gallery_video_icon',
804 [
805 'label' => __( 'Always Show Play Icon', 'premium-addons-for-elementor' ),
806 'type' => Controls_Manager::SWITCHER,
807 'return_value' => 'true',
808 'default' => 'true',
809 'condition' => [
810 'premium_gallery_img_style!' => 'style2'
811 ],
812
813 ]
814 );
815
816 $this->add_control('premium_gallery_videos_icon',
817 [
818 'label' => __( 'Videos Play Icon', 'premium-addons-for-elementor' ),
819 'type' => Controls_Manager::ICONS,
820 'default' => [
821 'library' => 'fa-solid',
822 'value' => 'fas fa-play',
823 ]
824 ]
825 );
826
827 $this->add_control('premium_gallery_rtl_mode',
828 [
829 'label' => __( 'RTL Mode', 'premium-addons-for-elementor' ),
830 'description' => __('This option moves the origin of the grid to the right side. Useful for RTL direction sites', 'premium-addons-for-elementor'),
831 'type' => Controls_Manager::SWITCHER,
832 'separator' => 'before'
833 ]
834 );
835
836 $this->add_responsive_control('premium_gallery_content_align',
837 [
838 'label' => __( 'Content Alignment', 'premium-addons-for-elementor' ),
839 'type' => Controls_Manager::CHOOSE,
840 'options' => [
841 'left' => [
842 'title'=> __( 'Left', 'premium-addons-for-elementor' ),
843 'icon' => 'fa fa-align-left',
844 ],
845 'center' => [
846 'title'=> __( 'Center', 'premium-addons-for-elementor' ),
847 'icon' => 'fa fa-align-center',
848 ],
849 'right' => [
850 'title'=> __( 'Right', 'premium-addons-for-elementor' ),
851 'icon' => 'fa fa-align-right',
852 ],
853 ],
854 'default' => 'center',
855 'separator' => 'before',
856 'selectors' => [
857 '{{WRAPPER}} .premium-gallery-caption' => 'text-align: {{VALUE}};',
858 ],
859 ]
860 );
861
862 $this->end_controls_section();
863
864 $this->start_controls_section('premium_gallery_lightbox_section',
865 [
866 'label' => __('Lightbox', 'premium-addons-for-elementor'),
867 ]
868 );
869
870 $this->add_control('premium_gallery_light_box',
871 [
872 'label' => __( 'Lightbox', 'premium-addons-for-elementor' ),
873 'type' => Controls_Manager::SWITCHER,
874 'default' => 'yes',
875 'separator' => 'before'
876 ]
877 );
878
879 $this->add_control('premium_gallery_lightbox_type',
880 [
881 'label' => __( 'Lightbox Style', 'premium-addons-for-elementor' ),
882 'type' => Controls_Manager::SELECT,
883 'default' => 'default',
884 'options' => [
885 'default' => __( 'PrettyPhoto', 'premium-addons-for-elementor' ),
886 'yes' => __( 'Elementor', 'premium-addons-for-elementor' ),
887 'no' => __( 'Other Lightbox Plugin', 'premium-addons-for-elementor' ),
888 ],
889 'condition' => [
890 'premium_gallery_light_box' => 'yes',
891 ],
892 ]
893 );
894
895 $this->add_control('lightbox_show_title',
896 [
897 'label' => __( 'Show Image Title', 'premium-addons-for-elementor' ),
898 'type' => Controls_Manager::SWITCHER,
899 'default' => 'yes',
900 'condition' => [
901 'premium_gallery_light_box' => 'yes',
902 'premium_gallery_lightbox_type' => 'yes'
903 ]
904 ]
905 );
906
907 $this->add_control('premium_gallery_lightbox_doc',
908 [
909 'raw' => __( 'Please note Elementor lightbox style is always applied on videos.', 'premium-addons-for-elementor' ),
910 'type' => Controls_Manager::RAW_HTML,
911 'content_classes' => 'editor-pa-doc',
912 ]
913 );
914
915 $this->add_control('premium_gallery_lightbox_theme',
916 [
917 'label' => __('Lightbox Theme', 'premium-addons-for-elementor'),
918 'type' => Controls_Manager::SELECT,
919 'options' => [
920 'pp_default' => __('Default', 'premium-addons-for-elementor'),
921 'light_rounded' => __('Light Rounded', 'premium-addons-for-elementor'),
922 'dark_rounded' => __('Dark Rounded', 'premium-addons-for-elementor'),
923 'light_square' => __('Light Square', 'premium-addons-for-elementor'),
924 'dark_square' => __('Dark Square', 'premium-addons-for-elementor'),
925 'facebook' => __('Facebook', 'premium-addons-for-elementor'),
926 ],
927 'default' => 'pp_default',
928 'condition' => [
929 'premium_gallery_light_box' => 'yes',
930 'premium_gallery_lightbox_type' => 'default'
931 ]
932 ]
933 );
934
935 $this->add_control('premium_gallery_overlay_gallery',
936 [
937 'label' => __( 'Overlay Gallery Images', 'premium-addons-for-elementor' ),
938 'type' => Controls_Manager::SWITCHER,
939 'condition' => [
940 'premium_gallery_light_box' => 'yes',
941 'premium_gallery_lightbox_type' => 'default'
942 ]
943 ]
944 );
945
946 $this->add_control('premium_gallery_lightbox_icon',
947 [
948 'label' => __( 'Lightbox Icon', 'premium-addons-for-elementor' ),
949 'type' => Controls_Manager::ICONS,
950 'default' => [
951 'library' => 'fa-solid',
952 'value' => 'fas fa-search',
953 ],
954 'condition' => [
955 'premium_gallery_light_box' => 'yes'
956 ]
957 ]
958 );
959
960 $this->end_controls_section();
961
962 $this->start_controls_section('premium_gallery_responsive_section',
963 [
964 'label' => __('Responsive', 'premium-addons-for-elementor'),
965 ]);
966
967 $this->add_control('premium_gallery_responsive_switcher',
968 [
969 'label' => __('Responsive Controls', 'premium-addons-for-elementor'),
970 'type' => Controls_Manager::SWITCHER,
971 'description' => __('If the content text is not suiting well on specific screen sizes, you may enable this option which will hide the description text.', 'premium-addons-for-elementor')
972 ]);
973
974 $this->add_control('premium_gallery_min_range',
975 [
976 'label' => __('Minimum Size', 'premium-addons-for-elementor'),
977 'type' => Controls_Manager::NUMBER,
978 'description'=> __('Note: minimum size for extra small screens is 1px.','premium-addons-for-elementor'),
979 'default' => 1,
980 'condition' => [
981 'premium_gallery_responsive_switcher' => 'yes'
982 ],
983 ]);
984
985 $this->add_control('premium_gallery_max_range',
986 [
987 'label' => __('Maximum Size', 'premium-addons-for-elementor'),
988 'type' => Controls_Manager::NUMBER,
989 'description'=> __('Note: maximum size for extra small screens is 767px.','premium-addons-for-elementor'),
990 'default' => 767,
991 'condition' => [
992 'premium_gallery_responsive_switcher' => 'yes'
993 ],
994 ]);
995
996 $this->end_controls_section();
997
998
999 $this->start_controls_section('section_pa_docs',
1000 [
1001 'label' => __('Helpful Documentations', 'premium-addons-for-elementor'),
1002 ]
1003 );
1004
1005 $docs = [
1006 'https://premiumaddons.com/docs/grid-widget-tutorial' => 'Getting started »',
1007 'https://premiumaddons.com/docs/how-to-assign-an-image-to-multiple-categories' => 'How to assign a grid item to multiple categories »',
1008 'https://premiumaddons.com/docs/how-to-open-a-popup-lightbox-through-a-grid-image' => 'How to open an Elementor popup/lightbox using a grid item »',
1009 ];
1010
1011 $doc_index = 1;
1012 foreach( $docs as $url => $title ) {
1013
1014 $doc_url = Helper_Functions::get_campaign_link( $url, 'editor-page', 'wp-editor', 'get-support' );
1015
1016 $this->add_control('doc_' . $doc_index,
1017 [
1018 'type' => Controls_Manager::RAW_HTML,
1019 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url , __( $title, 'premium-addons-for-elementor' ) ),
1020 'content_classes' => 'editor-pa-doc',
1021 ]
1022 );
1023
1024 $doc_index++;
1025
1026 }
1027
1028 $this->end_controls_section();
1029
1030 $this->start_controls_section('premium_gallery_general_style',
1031 [
1032 'label' => __('General','premium-addons-for-elementor'),
1033 'tab' => Controls_Manager::TAB_STYLE,
1034 ]);
1035
1036 $this->add_group_control(
1037 Group_Control_Background::get_type(),
1038 [
1039 'name' => 'premium_gallery_general_background',
1040 'types' => [ 'classic', 'gradient' ],
1041 'selector' => '{{WRAPPER}} .premium-img-gallery',
1042 ]
1043 );
1044
1045 $this->add_group_control(
1046 Group_Control_Border::get_type(),
1047 [
1048 'name' => 'premium_gallery_general_border',
1049 'selector' => '{{WRAPPER}} .premium-img-gallery',
1050 ]
1051 );
1052
1053 $this->add_control('premium_gallery_general_border_radius',
1054 [
1055 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1056 'type' => Controls_Manager::SLIDER,
1057 'size_units' => ['px', '%', 'em'],
1058 'selectors' => [
1059 '{{WRAPPER}} .premium-img-gallery' => 'border-radius: {{SIZE}}{{UNIT}};'
1060 ]
1061 ]
1062 );
1063
1064 $this->add_group_control(
1065 Group_Control_Box_Shadow::get_type(),
1066 [
1067 'name' => 'premium_gallery_general_box_shadow',
1068 'selector' => '{{WRAPPER}} .premium-img-gallery',
1069 ]
1070 );
1071
1072 $this->add_responsive_control('premium_gallery_general_margin',
1073 [
1074 'label' => __('Margin', 'premium-addons-for-elementor'),
1075 'type' => Controls_Manager::DIMENSIONS,
1076 'size_units' => [ 'px', 'em', '%' ],
1077 'selectors' => [
1078 '{{WRAPPER}} .premium-img-gallery' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1079 ]
1080 ]
1081 );
1082
1083 $this->add_responsive_control('premium_gallery_general_padding',
1084 [
1085 'label' => __('Padding', 'premium-addons-for-elementor'),
1086 'type' => Controls_Manager::DIMENSIONS,
1087 'size_units' => [ 'px', 'em', '%' ],
1088 'selectors' => [
1089 '{{WRAPPER}} .premium-img-gallery' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1090 ]
1091 ]
1092 );
1093
1094 $this->end_controls_section();
1095
1096 $this->start_controls_section('premium_gallery_img_style_section',
1097 [
1098 'label' => __('Image','premium-addons-for-elementor'),
1099 'tab' => Controls_Manager::TAB_STYLE,
1100 ]);
1101
1102 $this->add_control('premium_gallery_icons_style_overlay',
1103 [
1104 'label' => __('Hover Overlay Color', 'premium-addons-for-elementor'),
1105 'type' => Controls_Manager::COLOR,
1106 'selectors' => [
1107 '{{WRAPPER}} .pa-gallery-img:not(.style2):hover .pa-gallery-icons-wrapper, {{WRAPPER}} .pa-gallery-img .pa-gallery-icons-caption-container, {{WRAPPER}} .pa-gallery-img:hover .pa-gallery-icons-caption-container' => 'background-color: {{VALUE}};',
1108 ],
1109 ]
1110 );
1111
1112 $this->add_group_control(
1113 Group_Control_Border::get_type(),
1114 [
1115 'name' => 'premium_gallery_img_border',
1116 'selector' => '{{WRAPPER}} .pa-gallery-img-container',
1117 ]
1118 );
1119
1120 $this->add_control('premium_gallery_img_border_radius',
1121 [
1122 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1123 'type' => Controls_Manager::SLIDER,
1124 'size_units' => ['px', '%', 'em'],
1125 'selectors' => [
1126 '{{WRAPPER}} .pa-gallery-img-container' => 'border-radius: {{SIZE}}{{UNIT}};'
1127 ]
1128 ]
1129 );
1130
1131 $this->add_group_control(
1132 Group_Control_Box_Shadow::get_type(),
1133 [
1134 'label' => __('Shadow','premium-addons-for-elementor'),
1135 'name' => 'premium_gallery_img_box_shadow',
1136 'selector' => '{{WRAPPER}} .pa-gallery-img-container',
1137 'condition' => [
1138 'premium_gallery_img_style!' => 'style1'
1139 ]
1140 ]
1141 );
1142
1143 $this->add_group_control(
1144 Group_Control_Css_Filter::get_type(),
1145 [
1146 'name' => 'css_filters',
1147 'selector' => '{{WRAPPER}} .pa-gallery-img-container img',
1148 ]
1149 );
1150
1151 $this->add_group_control(
1152 Group_Control_Css_Filter::get_type(),
1153 [
1154 'label' => __('Hover CSS Filters', 'premium-addons-for-elementor'),
1155 'name' => 'hover_css_filters',
1156 'selector' => '{{WRAPPER}} .premium-gallery-item:hover img',
1157 ]
1158 );
1159
1160 $this->add_responsive_control('premium_gallery_img_margin',
1161 [
1162 'label' => __('Margin', 'premium-addons-for-elementor'),
1163 'type' => Controls_Manager::DIMENSIONS,
1164 'size_units' => [ 'px', 'em', '%' ],
1165 'selectors' => [
1166 '{{WRAPPER}} .pa-gallery-img-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1167 ]
1168 ]
1169 );
1170
1171 $this->add_responsive_control('premium_gallery_img_padding',
1172 [
1173 'label' => __('Padding', 'premium-addons-for-elementor'),
1174 'type' => Controls_Manager::DIMENSIONS,
1175 'size_units' => [ 'px', 'em', '%' ],
1176 'selectors' => [
1177 '{{WRAPPER}} .pa-gallery-img-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1178 ]
1179 ]
1180 );
1181
1182 $this->end_controls_section();
1183
1184 $this->start_controls_section('premium_gallery_content_style',
1185 [
1186 'label' => __('Title / Description','premium-addons-for-elementor'),
1187 'tab' => Controls_Manager::TAB_STYLE,
1188 ]);
1189
1190 $this->add_control('premium_gallery_title_heading',
1191 [
1192 'label' => __('Title', 'premium-addons-for-elementor'),
1193 'type' => Controls_Manager::HEADING,
1194 ]
1195 );
1196
1197 $this->add_control('premium_gallery_title_color',
1198 [
1199 'label' => __('Color', 'premium-addons-for-elementor'),
1200 'type' => Controls_Manager::COLOR,
1201 'scheme' => [
1202 'type' => Scheme_Color::get_type(),
1203 'value' => Scheme_Color::COLOR_2,
1204 ],
1205 'selectors' => [
1206 '{{WRAPPER}} .premium-gallery-img-name, {{WRAPPER}} .premium-gallery-img-name a' => 'color: {{VALUE}};',
1207 ]
1208 ]
1209 );
1210
1211 $this->add_group_control(
1212 Group_Control_Typography::get_type(),
1213 [
1214 'name' => 'premium_gallery_title_typo',
1215 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
1216 'selector' => '{{WRAPPER}} .premium-gallery-img-name, {{WRAPPER}} .premium-gallery-img-name a',
1217 ]
1218 );
1219
1220 $this->add_control('premium_gallery_description_heading',
1221 [
1222 'label' => __('Description', 'premium-addons-for-elementor'),
1223 'type' => Controls_Manager::HEADING,
1224 'separator' => 'before',
1225 ]
1226 );
1227
1228 $this->add_control('premium_gallery_description_color',
1229 [
1230 'label' => __('Color', 'premium-addons-for-elementor'),
1231 'type' => Controls_Manager::COLOR,
1232 'scheme' => [
1233 'type' => Scheme_Color::get_type(),
1234 'value' => Scheme_Color::COLOR_3,
1235 ],
1236 'selectors' => [
1237 '{{WRAPPER}} .premium-gallery-img-desc, {{WRAPPER}} .premium-gallery-img-desc a' => 'color: {{VALUE}};',
1238 ]
1239 ]
1240 );
1241
1242 $this->add_group_control(
1243 Group_Control_Typography::get_type(),
1244 [
1245 'name' => 'premium_gallery_description_typo',
1246 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
1247 'selector' => '{{WRAPPER}} .premium-gallery-img-desc, {{WRAPPER}} .premium-gallery-img-desc a',
1248 ]
1249 );
1250
1251 $this->add_group_control(
1252 Group_Control_Background::get_type(),
1253 [
1254 'name' => 'premium_gallery_content_background',
1255 'types' => [ 'classic', 'gradient' ],
1256 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1257 'separator' => 'before',
1258 ]
1259 );
1260
1261 $this->add_group_control(
1262 Group_Control_Border::get_type(),
1263 [
1264 'name' => 'premium_gallery_content_border',
1265 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1266 ]
1267 );
1268
1269 $this->add_control('premium_gallery_content_border_radius',
1270 [
1271 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1272 'type' => Controls_Manager::SLIDER,
1273 'size_units' => ['px', '%', 'em'],
1274 'selectors' => [
1275 '{{WRAPPER}} .premium-gallery-caption' => 'border-radius: {{SIZE}}{{UNIT}};'
1276 ]
1277 ]
1278 );
1279
1280 $this->add_group_control(
1281 Group_Control_Text_Shadow::get_type(),
1282 [
1283 'label' => __('Shadow','premium-addons-for-elementor'),
1284 'name' => 'premium_gallery_content_shadow',
1285 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1286 ]
1287 );
1288
1289 $this->add_group_control(
1290 Group_Control_Box_Shadow::get_type(),
1291 [
1292 'name' => 'premium_gallery_content_box_shadow',
1293 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1294 ]
1295 );
1296
1297 $this->add_responsive_control('premium_gallery_content_margin',
1298 [
1299 'label' => __('Margin', 'premium-addons-for-elementor'),
1300 'type' => Controls_Manager::DIMENSIONS,
1301 'size_units' => [ 'px', 'em', '%' ],
1302 'selectors' => [
1303 '{{WRAPPER}} .premium-gallery-caption' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1304 ]
1305 ]
1306 );
1307
1308 $this->add_responsive_control('premium_gallery_content_padding',
1309 [
1310 'label' => __('Padding', 'premium-addons-for-elementor'),
1311 'type' => Controls_Manager::DIMENSIONS,
1312 'size_units' => [ 'px', 'em', '%' ],
1313 'selectors' => [
1314 '{{WRAPPER}} .premium-gallery-caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1315 ]
1316 ]
1317 );
1318
1319 $this->end_controls_section();
1320
1321 $this->start_controls_section('premium_gallery_icons_style',
1322 [
1323 'label' => __('Icons','premium-addons-for-elementor'),
1324 'tab' => Controls_Manager::TAB_STYLE,
1325 ]);
1326
1327 $this->add_responsive_control('premium_gallery_style1_icons_position',
1328 [
1329 'label' => __('Position', 'premium-addons-for-elementor'),
1330 'type' => Controls_Manager::SLIDER,
1331 'size_units' => ['px', '%', 'em'],
1332 'range' => [
1333 'px' => [
1334 'min' => 0,
1335 'max' => 300,
1336 ]
1337 ],
1338 'label_block' => true,
1339 'selectors' => [
1340 '{{WRAPPER}} .pa-gallery-img:not(.style2) .pa-gallery-icons-inner-container' => 'top: {{SIZE}}{{UNIT}};',
1341 ],
1342 'condition' => [
1343 'premium_gallery_img_style!' => 'style2'
1344 ]
1345 ]
1346 );
1347
1348 $this->add_responsive_control('premium_gallery_icons_size',
1349 [
1350 'label' => __('Size', 'premium-addons-for-elementor'),
1351 'type' => Controls_Manager::SLIDER,
1352 'size_units' => ['px', 'em'],
1353 'range' => [
1354 'px' => [
1355 'min' => 1,
1356 'max' => 50,
1357 ]
1358 ],
1359 'label_block' => true,
1360 'selectors' => [
1361 '{{WRAPPER}} .pa-gallery-icons-inner-container i, {{WRAPPER}} .pa-gallery-icons-caption-cell i' => 'font-size: {{SIZE}}{{UNIT}}',
1362 '{{WRAPPER}} .pa-gallery-icons-inner-container svg, {{WRAPPER}} .pa-gallery-icons-caption-cell svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}'
1363 ],
1364 ]
1365 );
1366
1367 $this->start_controls_tabs('premium_gallery_icons_style_tabs');
1368
1369 $this->start_controls_tab('premium_gallery_icons_style_normal',
1370 [
1371 'label' => __('Normal', 'premium-addons-for-elementor'),
1372 ]
1373 );
1374
1375 $this->add_control('premium_gallery_icons_style_color',
1376 [
1377 'label' => __('Color', 'premium-addons-for-elementor'),
1378 'type' => Controls_Manager::COLOR,
1379 'scheme' => [
1380 'type' => Scheme_Color::get_type(),
1381 'value' => Scheme_Color::COLOR_1,
1382 ],
1383 'selectors' => [
1384 '{{WRAPPER}} .pa-gallery-magnific-image i, {{WRAPPER}} .pa-gallery-img-link i' => 'color: {{VALUE}};',
1385 ]
1386 ]
1387 );
1388
1389 $this->add_control('premium_gallery_icons_style_background',
1390 [
1391 'label' => __('Background Color', 'premium-addons-for-elementor'),
1392 'type' => Controls_Manager::COLOR,
1393 'scheme' => [
1394 'type' => Scheme_Color::get_type(),
1395 'value' => Scheme_Color::COLOR_2,
1396 ],
1397 'selectors' => [
1398 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'background-color: {{VALUE}};',
1399 ]
1400 ]
1401 );
1402
1403 $this->add_group_control(
1404 Group_Control_Border::get_type(),
1405 [
1406 'name' => 'premium_gallery_icons_style_border',
1407 'selector' => '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span',
1408 ]
1409 );
1410
1411 $this->add_control('premium_gallery_icons_style_border_radius',
1412 [
1413 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1414 'type' => Controls_Manager::SLIDER,
1415 'size_units' => ['px', 'em' , '%'],
1416 'selectors' => [
1417 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'border-radius: {{SIZE}}{{UNIT}};'
1418 ]
1419 ]
1420 );
1421
1422 $this->add_group_control(
1423 Group_Control_Box_Shadow::get_type(),
1424 [
1425 'label' => __('Shadow','premium-addons-for-elementor'),
1426 'name' => 'premium_gallery_icons_style_shadow',
1427 'selector' => '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span',
1428 ]
1429 );
1430
1431 $this->add_responsive_control('premium_gallery_icons_style_margin',
1432 [
1433 'label' => __('Margin', 'premium-addons-for-elementor'),
1434 'type' => Controls_Manager::DIMENSIONS,
1435 'size_units' => ['px', 'em', '%'],
1436 'selectors' => [
1437 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1438 ]
1439 ]);
1440
1441 $this->add_responsive_control('premium_gallery_icons_style_padding',
1442 [
1443 'label' => __('Padding', 'premium-addons-for-elementor'),
1444 'type' => Controls_Manager::DIMENSIONS,
1445 'size_units' => ['px', 'em', '%'],
1446 'selectors' => [
1447 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1448 ]
1449 ]);
1450
1451 $this->end_controls_tab();
1452
1453 $this->start_controls_tab('premium_gallery_icons_style_hover',
1454 [
1455 'label' => __('Hover', 'premium-addons-for-elementor'),
1456 ]
1457 );
1458
1459 $this->add_control('premium_gallery_icons_style_color_hover',
1460 [
1461 'label' => __('Color', 'premium-addons-for-elementor'),
1462 'type' => Controls_Manager::COLOR,
1463 'scheme' => [
1464 'type' => Scheme_Color::get_type(),
1465 'value' => Scheme_Color::COLOR_1,
1466 ],
1467 'selectors' => [
1468 '{{WRAPPER}} .pa-gallery-magnific-image:hover i, {{WRAPPER}} .pa-gallery-img-link:hover i' => 'color: {{VALUE}};',
1469 ]
1470 ]
1471 );
1472
1473 $this->add_control('premium_gallery_icons_style_background_hover',
1474 [
1475 'label' => __('Background Color', 'premium-addons-for-elementor'),
1476 'type' => Controls_Manager::COLOR,
1477 'scheme' => [
1478 'type' => Scheme_Color::get_type(),
1479 'value' => Scheme_Color::COLOR_2,
1480 ],
1481 'selectors' => [
1482 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'background-color: {{VALUE}};',
1483 ]
1484 ]
1485 );
1486
1487 $this->add_group_control(
1488 Group_Control_Border::get_type(),
1489 [
1490 'name' => 'premium_gallery_icons_style_border_hover',
1491 'selector' => '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span',
1492 ]
1493 );
1494
1495 $this->add_control('premium_gallery_icons_style_border_radius_hover',
1496 [
1497 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1498 'type' => Controls_Manager::SLIDER,
1499 'size_units' => ['px', 'em' , '%' ],
1500 'selectors' => [
1501 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'border-radius: {{SIZE}}{{UNIT}};'
1502 ]
1503 ]
1504 );
1505
1506 $this->add_group_control(
1507 Group_Control_Box_Shadow::get_type(),
1508 [
1509 'label' => __('Shadow','premium-addons-for-elementor'),
1510 'name' => 'premium_gallery_icons_style_shadow_hover',
1511 'selector' => '{{WRAPPER}} {{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span',
1512 ]
1513 );
1514
1515 $this->add_responsive_control('premium_gallery_icons_style_margin_hover',
1516 [
1517 'label' => __('Margin', 'premium-addons-for-elementor'),
1518 'type' => Controls_Manager::DIMENSIONS,
1519 'size_units' => ['px', 'em', '%'],
1520 'selectors' => [
1521 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1522 ]
1523 ]);
1524
1525 $this->add_responsive_control('premium_gallery_icons_style_padding_hover',
1526 [
1527 'label' => __('Padding', 'premium-addons-for-elementor'),
1528 'type' => Controls_Manager::DIMENSIONS,
1529 'size_units' => ['px', 'em', '%'],
1530 'selectors' => [
1531 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1532 ]
1533 ]);
1534
1535 $this->end_controls_tab();
1536
1537 $this->end_controls_tabs();
1538
1539 $this->end_controls_section();
1540
1541 $this->start_controls_section('premium_gallery_filter_style',
1542 [
1543 'label' => __('Filter','premium-addons-for-elementor'),
1544 'tab' => Controls_Manager::TAB_STYLE,
1545 'condition' => [
1546 'premium_gallery_filter' => 'yes'
1547 ]
1548 ]);
1549
1550 $this->add_group_control(
1551 Group_Control_Typography::get_type(),
1552 [
1553 'name' => 'premium_gallery_filter_typo',
1554 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
1555 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category',
1556 ]
1557 );
1558
1559 $this->start_controls_tabs('premium_gallery_filters');
1560
1561 $this->start_controls_tab('premium_gallery_filters_normal',
1562 [
1563 'label' => __('Normal', 'premium-addons-for-elementor'),
1564 ]
1565 );
1566
1567 $this->add_control('premium_gallery_filter_color',
1568 [
1569 'label' => __('Text Color', 'premium-addons-for-elementor'),
1570 'type' => Controls_Manager::COLOR,
1571 'scheme' => [
1572 'type' => Scheme_Color::get_type(),
1573 'value' => Scheme_Color::COLOR_2,
1574 ],
1575 'selectors' => [
1576 '{{WRAPPER}} .premium-gallery-cats-container li a.category span' => 'color: {{VALUE}};',
1577 ]
1578 ]
1579 );
1580
1581 $this->add_control('premium_gallery_background_color',
1582 [
1583 'label' => __('Background Color', 'premium-addons-for-elementor'),
1584 'type' => Controls_Manager::COLOR,
1585 'selectors' => [
1586 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'background-color: {{VALUE}};',
1587 ],
1588 ]
1589 );
1590
1591 $this->add_group_control(
1592 Group_Control_Border::get_type(),
1593 [
1594 'name' => 'premium_gallery_filter_border',
1595 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category',
1596 ]
1597 );
1598
1599 $this->add_control('premium_gallery_filter_border_radius',
1600 [
1601 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1602 'type' => Controls_Manager::SLIDER,
1603 'size_units' => ['px','em','%'],
1604 'selectors' => [
1605 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'border-radius: {{SIZE}}{{UNIT}};',
1606 ]
1607 ]
1608 );
1609
1610 $this->end_controls_tab();
1611
1612 $this->start_controls_tab('premium_gallery_filters_hover',
1613 [
1614 'label' => __('Hover', 'premium-addons-for-elementor'),
1615 ]
1616 );
1617
1618 $this->add_control('premium_gallery_filter_hover_color',
1619 [
1620 'label' => __('Text Color', 'premium-addons-for-elementor'),
1621 'type' => Controls_Manager::COLOR,
1622 'selectors' => [
1623 '{{WRAPPER}} .premium-gallery-cats-container li a:hover span' => 'color: {{VALUE}};',
1624 ]
1625 ]
1626 );
1627
1628 $this->add_control('premium_gallery_background_hover_color',
1629 [
1630 'label' => __('Background Color', 'premium-addons-for-elementor'),
1631 'type' => Controls_Manager::COLOR,
1632 'selectors' => [
1633 '{{WRAPPER}} .premium-gallery-cats-container li a:hover' => 'background-color: {{VALUE}};',
1634 ],
1635 ]
1636 );
1637
1638 $this->add_group_control(
1639 Group_Control_Border::get_type(),
1640 [
1641 'name' => 'premium_gallery_filter_border_hover',
1642 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category:hover',
1643 ]
1644 );
1645
1646 $this->add_control('premium_gallery_filter_border_radius_hover',
1647 [
1648 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1649 'type' => Controls_Manager::SLIDER,
1650 'size_units' => ['px','em','%'],
1651 'selectors' => [
1652 '{{WRAPPER}} .premium-gallery-cats-container li a.category:hover' => 'border-radius: {{SIZE}}{{UNIT}};',
1653 ]
1654 ]
1655 );
1656
1657 $this->end_controls_tab();
1658
1659 $this->start_controls_tab('premium_gallery_filters_active',
1660 [
1661 'label' => __('Active', 'premium-addons-for-elementor'),
1662 ]
1663 );
1664
1665 $this->add_control('premium_gallery_filter_active_color',
1666 [
1667 'label' => __('Text Color', 'premium-addons-for-elementor'),
1668 'type' => Controls_Manager::COLOR,
1669 'scheme' => [
1670 'type' => Scheme_Color::get_type(),
1671 'value' => Scheme_Color::COLOR_1,
1672 ],
1673 'selectors' => [
1674 '{{WRAPPER}} .premium-gallery-cats-container li a.active span' => 'color: {{VALUE}};',
1675 ],
1676 ]
1677 );
1678
1679 $this->add_control('premium_gallery_background_active_color',
1680 [
1681 'label' => __('Background Color', 'premium-addons-for-elementor'),
1682 'type' => Controls_Manager::COLOR,
1683 'selectors' => [
1684 '{{WRAPPER}} .premium-gallery-cats-container li a.active' => 'background-color: {{VALUE}};',
1685 ],
1686 ]
1687 );
1688
1689 $this->add_group_control(
1690 Group_Control_Border::get_type(),
1691 [
1692 'name' => 'premium_gallery_filter_border_active',
1693 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.active',
1694 ]
1695 );
1696
1697 $this->add_control('premium_gallery_filter_border_radius_active',
1698 [
1699 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1700 'type' => Controls_Manager::SLIDER,
1701 'size_units' => ['px','em','%'],
1702 'selectors' => [
1703 '{{WRAPPER}} .premium-gallery-cats-container li a.active' => 'border-radius: {{SIZE}}{{UNIT}};',
1704 ]
1705 ]
1706 );
1707
1708 $this->end_controls_tab();
1709
1710 $this->end_controls_tabs();
1711
1712 $this->add_group_control(
1713 Group_Control_Box_Shadow::get_type(),
1714 [
1715 'name' => 'premium_gallery_filter_shadow',
1716 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category',
1717 ]
1718 );
1719
1720 $this->add_responsive_control('premium_gallery_filter_margin',
1721 [
1722 'label' => __('Margin', 'premium-addons-for-elementor'),
1723 'type' => Controls_Manager::DIMENSIONS,
1724 'size_units' => ['px', 'em', '%'],
1725 'selectors' => [
1726 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1727 ],
1728 ]
1729 );
1730
1731 $this->add_responsive_control('premium_gallery_filter_padding',
1732 [
1733 'label' => __('Padding', 'premium-addons-for-elementor'),
1734 'type' => Controls_Manager::DIMENSIONS,
1735 'size_units' => ['px', 'em', '%'],
1736 'selectors' => [
1737 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1738 ],
1739 ]
1740 );
1741
1742 $this->end_controls_section();
1743
1744 $this->start_controls_section('premium_gallery_button_style_settings',
1745 [
1746 'label' => __('Load More Button', 'premium-addons-for-elementor'),
1747 'tab' => Controls_Manager::TAB_STYLE,
1748 'condition' => [
1749 'premium_gallery_load_more' => 'yes',
1750 ]
1751 ]
1752 );
1753
1754 $this->add_group_control(
1755 Group_Control_Typography::get_type(),
1756 [
1757 'name' => 'premium_gallery_button_typo',
1758 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
1759 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
1760 ]
1761 );
1762
1763 $this->start_controls_tabs('premium_gallery_button_style_tabs');
1764
1765 $this->start_controls_tab('premium_gallery_button_style_normal',
1766 [
1767 'label' => __('Normal', 'premium-addons-for-elementor'),
1768 ]
1769 );
1770
1771 $this->add_control('premium_gallery_button_color',
1772 [
1773 'label' => __('Text Color', 'premium-addons-for-elementor'),
1774 'type' => Controls_Manager::COLOR,
1775 'scheme' => [
1776 'type' => Scheme_Color::get_type(),
1777 'value' => Scheme_Color::COLOR_2,
1778 ],
1779 'selectors' => [
1780 '{{WRAPPER}} .premium-gallery-load-more-btn' => 'color: {{VALUE}};',
1781 '{{WRAPPER}} .premium-gallery-load-more-btn .premium-loader' => 'border-color: {{VALUE}};',
1782 ]
1783 ]
1784 );
1785
1786 $this->add_control('premium_gallery_button_spin_color',
1787 [
1788 'label' => __('Spinner Color', 'premium-addons-for-elementor'),
1789 'type' => Controls_Manager::COLOR,
1790 'scheme' => [
1791 'type' => Scheme_Color::get_type(),
1792 'value' => Scheme_Color::COLOR_2,
1793 ],
1794 'selectors' => [
1795 '{{WRAPPER}} .premium-gallery-load-more-btn .premium-loader' => 'border-top-color: {{VALUE}};'
1796 ]
1797 ]
1798 );
1799
1800 $this->add_group_control(
1801 Group_Control_Text_Shadow::get_type(),
1802 [
1803 'name' => 'premium_gallery_button_text_shadow',
1804 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
1805 ]
1806 );
1807
1808 $this->add_group_control(
1809 Group_Control_Background::get_type(),
1810 [
1811 'name' => 'premium_gallery_button_background',
1812 'types' => [ 'classic' , 'gradient' ],
1813 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
1814 ]
1815 );
1816
1817 $this->add_group_control(
1818 Group_Control_Border::get_type(),
1819 [
1820 'name' => 'premium_gallery_button_border',
1821 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
1822 ]
1823 );
1824
1825 $this->add_control('premium_gallery_button_border_radius',
1826 [
1827 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1828 'type' => Controls_Manager::SLIDER,
1829 'size_units' => ['px', 'em' , '%'],
1830 'selectors' => [
1831 '{{WRAPPER}} .premium-gallery-load-more-btn' => 'border-radius: {{SIZE}}{{UNIT}};'
1832 ]
1833 ]
1834 );
1835
1836 $this->add_group_control(
1837 Group_Control_Box_Shadow::get_type(),
1838 [
1839 'name' => 'premium_gallery_button_box_shadow',
1840 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
1841 ]
1842 );
1843
1844 $this->add_responsive_control('premium_gallery_button_margin',
1845 [
1846 'label' => __('Margin', 'premium-addons-for-elementor'),
1847 'type' => Controls_Manager::DIMENSIONS,
1848 'size_units' => ['px', 'em', '%'],
1849 'selectors' => [
1850 '{{WRAPPER}} .premium-gallery-load-more-btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1851 ]
1852 ]
1853 );
1854
1855 $this->add_responsive_control('premium_gallery_button_padding',
1856 [
1857 'label' => __('Padding', 'premium-addons-for-elementor'),
1858 'type' => Controls_Manager::DIMENSIONS,
1859 'size_units' => ['px', 'em', '%'],
1860 'selectors' => [
1861 '{{WRAPPER}} .premium-gallery-load-more-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1862 ]
1863 ]
1864 );
1865
1866 $this->end_controls_tab();
1867
1868 $this->start_controls_tab('premium_gallery_button_style_hover',
1869 [
1870 'label' => __('Hover', 'premium-addons-for-elementor'),
1871 ]
1872 );
1873
1874 $this->add_control('premium_gallery_button_hover_color',
1875 [
1876 'label' => __('Text Hover Color', 'premium-addons-for-elementor'),
1877 'type' => Controls_Manager::COLOR,
1878 'scheme' => [
1879 'type' => Scheme_Color::get_type(),
1880 'value' => Scheme_Color::COLOR_2,
1881 ],
1882 'selectors' => [
1883 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'color: {{VALUE}};'
1884 ]
1885 ]
1886 );
1887
1888 $this->add_group_control(
1889 Group_Control_Text_Shadow::get_type(),
1890 [
1891 'name' => 'premium_gallery_button_text_shadow_hover',
1892 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
1893 ]
1894 );
1895
1896 $this->add_group_control(
1897 Group_Control_Background::get_type(),
1898 [
1899 'name' => 'premium_gallery_button_background_hover',
1900 'types' => [ 'classic' , 'gradient' ],
1901 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
1902 ]
1903 );
1904
1905 $this->add_group_control(
1906 Group_Control_Border::get_type(),
1907 [
1908 'name' => 'premium_gallery_button_border_hover',
1909 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
1910 ]
1911 );
1912
1913 $this->add_control('button_border_radius_hover',
1914 [
1915 'label' => __('Border Radius', 'premium-addons-for-elementor'),
1916 'type' => Controls_Manager::SLIDER,
1917 'size_units' => ['px', 'em' , '%' ],
1918 'selectors' => [
1919 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'border-radius: {{SIZE}}{{UNIT}};'
1920 ]
1921 ]
1922 );
1923
1924 $this->add_group_control(
1925 Group_Control_Box_Shadow::get_type(),
1926 [
1927 'name' => 'premium_gallery_button_shadow_hover',
1928 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
1929 ]
1930 );
1931
1932 $this->add_responsive_control('button_margin_hover',
1933 [
1934 'label' => __('Margin', 'premium-addons-for-elementor'),
1935 'type' => Controls_Manager::DIMENSIONS,
1936 'size_units' => ['px', 'em', '%'],
1937 'selectors' => [
1938 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1939 ]
1940 ]
1941 );
1942
1943 $this->add_responsive_control('premium_gallery_button_padding_hover',
1944 [
1945 'label' => __('Padding', 'premium-addons-for-elementor'),
1946 'type' => Controls_Manager::DIMENSIONS,
1947 'size_units' => ['px', 'em', '%'],
1948 'selectors' => [
1949 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1950 ]
1951 ]
1952 );
1953
1954 $this->end_controls_tab();
1955
1956 $this->end_controls_tabs();
1957
1958 $this->end_controls_section();
1959
1960 $this->start_controls_section('section_lightbox_style',
1961 [
1962 'label' => __( 'Lightbox', 'premium-addons-for-elementor' ),
1963 'tab' => Controls_Manager::TAB_STYLE,
1964 'condition' => [
1965 'premium_gallery_lightbox_type' => 'yes'
1966 ]
1967 ]
1968 );
1969
1970 $this->add_control('lightbox_color',
1971 [
1972 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1973 'type' => Controls_Manager::COLOR,
1974 'selectors' => [
1975 '#elementor-lightbox-slideshow-{{ID}}' => 'background-color: {{VALUE}};',
1976 ],
1977 ]
1978 );
1979
1980 $this->add_control('lightbox_ui_color',
1981 [
1982 'label' => __( 'UI Color', 'premium-addons-for-elementor' ),
1983 'type' => Controls_Manager::COLOR,
1984 'selectors' => [
1985 '#elementor-lightbox-slideshow-{{ID}} .dialog-lightbox-close-button, #elementor-lightbox-slideshow-{{ID}} .elementor-swiper-button' => 'color: {{VALUE}};',
1986 ],
1987 ]
1988 );
1989
1990 $this->add_control('lightbox_ui_hover_color',
1991 [
1992 'label' => __( 'UI Hover Color', 'premium-addons-for-elementor' ),
1993 'type' => Controls_Manager::COLOR,
1994 'selectors' => [
1995 '#elementor-lightbox-slideshow-{{ID}} .dialog-lightbox-close-button:hover, #elementor-lightbox-slideshow-{{ID}} .elementor-swiper-button:hover' => 'color: {{VALUE}};',
1996 ],
1997 ]
1998 );
1999
2000 $this->end_controls_section();
2001
2002 $this->update_controls();
2003
2004 }
2005
2006 /*
2007 * Filter Cats
2008 *
2009 * Formats Category to be inserted in class attribute.
2010 *
2011 * @since 2.1.0
2012 * @access public
2013 *
2014 * @return string category slug
2015 */
2016 public function filter_cats( $string ) {
2017
2018 $cat_filtered = mb_strtolower( $string );
2019
2020 if( strpos( $cat_filtered, 'class' ) || strpos( $cat_filtered, 'src' ) ) {
2021 $cat_filtered = substr( $cat_filtered, strpos( $cat_filtered, '"' ) + 1 );
2022 $cat_filtered = strtok( $cat_filtered, '"' );
2023 $cat_filtered = preg_replace( '/[http:.]/', '', $cat_filtered );
2024 $cat_filtered = str_replace( '/', '', $cat_filtered );
2025 }
2026
2027 $cat_filtered = str_replace( ', ', ',', $cat_filtered );
2028 $cat_filtered = preg_replace( "/[\s_&@!#%]/", "-", $cat_filtered );
2029 $cat_filtered = str_replace( ',', ' ', $cat_filtered );
2030
2031 return $cat_filtered;
2032 }
2033
2034 /*
2035 * Render Filter Tabs on the frontend
2036 *
2037 * @since 2.1.0
2038 * @access protected
2039 *
2040 * @param string $first Class for the first category
2041 * @param number $active_index active category index
2042 */
2043 protected function render_filter_tabs( $first, $active_index ) {
2044
2045 $settings = $this->get_settings_for_display();
2046
2047 ?>
2048
2049 <div class="premium-img-gallery-filter">
2050 <ul class="premium-gallery-cats-container">
2051 <?php if( 'yes' == $settings['premium_gallery_first_cat_switcher'] ) : ?>
2052 <li>
2053 <a href="javascript:;" class="category <?php echo $first; ?>" data-filter="*">
2054 <span><?php echo $settings['premium_gallery_first_cat_label']; ?></span>
2055 </a>
2056 </li>
2057 <?php endif;
2058 foreach( $settings['premium_gallery_cats_content'] as $index => $category ) {
2059 if( ! empty( $category['premium_gallery_img_cat'] ) ) {
2060 $cat_filtered = $this->filter_cats( $category['premium_gallery_img_cat'] );
2061
2062 $key = 'premium_grid_category_' . $index;
2063
2064 if( $active_index === $index ) {
2065 $this->add_render_attribute( $key, 'class', 'active' );
2066 }
2067
2068 $this->add_render_attribute( $key,
2069 'class', [
2070 'category',
2071 'elementor-repeater-item-' . $category['_id']
2072 ]
2073 );
2074
2075 $slug = sprintf( '.%s', $cat_filtered );
2076
2077 $this->add_render_attribute( $key, 'data-filter', $slug );
2078 ?>
2079 <li>
2080 <a href="javascript:;" <?php echo $this->get_render_attribute_string( $key ); ?>>
2081 <span><?php echo $category['premium_gallery_img_cat']; ?></span>
2082 </a>
2083 </li>
2084 <?php }
2085 } ?>
2086 </ul>
2087 </div>
2088
2089 <?php
2090 }
2091
2092 /**
2093 * Render Grid output on the frontend.
2094 *
2095 * Written in PHP and used to generate the final HTML.
2096 *
2097 * @since 2.1.0
2098 * @access protected
2099 */
2100 protected function render() {
2101
2102 $settings = $this->get_settings_for_display();
2103
2104 $filter = $settings['premium_gallery_filter'];
2105
2106 $skin = $settings['premium_gallery_img_style'];
2107
2108 $layout = $settings['premium_gallery_img_size_select'];
2109
2110 $lightbox = $settings['premium_gallery_light_box'];
2111
2112 $lightbox_type = $settings['premium_gallery_lightbox_type'];
2113
2114 $show_play = $settings['premium_gallery_video_icon'];
2115
2116 if ( 'yes' === $settings['premium_gallery_responsive_switcher'] ) {
2117 $min_size = $settings['premium_gallery_min_range'] . 'px';
2118 $max_size = $settings['premium_gallery_max_range'] . 'px';
2119 }
2120
2121 $category = "*";
2122
2123 if ( 'yes' === $filter ) {
2124
2125 if ( ! empty( $settings['premium_gallery_active_cat'] ) || 0 === $settings['premium_gallery_active_cat'] ) {
2126
2127 if( 'yes' !== $settings['premium_gallery_first_cat_switcher'] ) {
2128 $active_index = $settings['premium_gallery_active_cat'];
2129 $active_category = $settings['premium_gallery_cats_content'][$active_index]['premium_gallery_img_cat'];
2130 $category = "." . $this->filter_cats( $active_category );
2131 $active_category_index = $settings['premium_gallery_active_cat'];
2132
2133 } else {
2134 $active_category_index = $settings['premium_gallery_active_cat'] - 1;
2135 }
2136
2137 } else {
2138 $active_category_index = 'yes' === $settings['premium_gallery_first_cat_switcher'] ? -1 : 0;
2139 }
2140
2141 $is_all_active = ( 0 > $active_category_index ) ? "active" : "";
2142
2143 }
2144
2145 if ( 'original' === $layout ) {
2146 $layout = 'masonry';
2147 } else if ( 'one_size' === $layout ) {
2148 $layout = 'fitRows';
2149 }
2150
2151 $ltr_mode = 'yes' === $settings['premium_gallery_rtl_mode'] ? false : true;
2152
2153 $shuffle = 'yes' === $settings['premium_gallery_shuffle'] ? true : false;
2154
2155 $shuffle_onload = 'yes' === $settings['premium_gallery_shuffle_onload'] ? 'random' : 'original-order';
2156
2157 $grid_settings = [
2158 'img_size' => $layout,
2159 'filter' => $filter,
2160 'theme' => $settings['premium_gallery_lightbox_theme'],
2161 'active_cat' => $category,
2162 'ltr_mode' => $ltr_mode,
2163 'shuffle' => $shuffle,
2164 'sort_by' => $shuffle_onload,
2165 'skin' => $skin
2166 ];
2167
2168 $load_more = 'yes' === $settings['premium_gallery_load_more'] ? true : false;
2169
2170 if( $load_more ) {
2171 $minimum = ! empty ( $settings['premium_gallery_load_minimum'] ) ? $settings['premium_gallery_load_minimum'] : 6;
2172 $click_number = ! empty ( $settings['premium_gallery_load_click_number'] ) ? $settings['premium_gallery_load_click_number'] : 6;
2173
2174 $grid_settings = array_merge( $grid_settings, [
2175 'load_more' => $load_more,
2176 'minimum' => $minimum,
2177 'click_images' => $click_number,
2178 ]);
2179 }
2180
2181 if ( 'yes' === $lightbox ) {
2182 $grid_settings = array_merge( $grid_settings, [
2183 'light_box' => $lightbox,
2184 'lightbox_type' => $lightbox_type,
2185 'overlay' => 'yes' === $settings['premium_gallery_overlay_gallery'] ? true : false,
2186 ]);
2187 } else {
2188 $this->add_render_attribute( 'grid', [
2189 'class' => [
2190 'premium-img-gallery-no-lightbox'
2191 ]
2192 ]
2193 );
2194 }
2195
2196 $this->add_render_attribute( 'grid', [
2197 'id' => 'premium-img-gallery-' . esc_attr( $this->get_id() ),
2198 'class' => [
2199 'premium-img-gallery',
2200 'premium-img-gallery-' . $layout,
2201 $settings['premium_gallery_img_effect']
2202 ]
2203 ]
2204 );
2205
2206 if ( $show_play ) {
2207 $this->add_render_attribute( 'grid', [
2208 'class' => [
2209 'premium-gallery-icon-show'
2210 ]
2211 ]
2212 );
2213 }
2214
2215 $this->add_render_attribute( 'container', 'class', [
2216 'pa-gallery-img-container'
2217 ]);
2218
2219 ?>
2220
2221 <div <?php echo $this->get_render_attribute_string( 'grid' ); ?>>
2222 <?php if( $filter == 'yes' ) :
2223 $this->render_filter_tabs( $is_all_active, $active_category_index );
2224 endif; ?>
2225
2226 <div class="premium-gallery-container" data-settings='<?php echo wp_json_encode( $grid_settings ); ?>'>
2227
2228 <?php if ( 'metro' === $layout ) : ?>
2229 <div class="grid-sizer"></div>
2230 <?php endif;
2231
2232 foreach( $settings['premium_gallery_img_content'] as $index => $image ) :
2233
2234 $key = 'gallery_item_' . $index;
2235
2236 $this->add_render_attribute( $key, [
2237 'class' => [
2238 'premium-gallery-item',
2239 'elementor-repeater-item-' . $image['_id'],
2240 $this->filter_cats( $image['premium_gallery_img_category'] )
2241 ]
2242 ]
2243 );
2244
2245 if ( 'metro' === $layout ) {
2246
2247 $cells = [
2248 'cells' => $image['premium_gallery_image_cell']['size'],
2249 'vcells' => $image['premium_gallery_image_vcell']['size'],
2250 'cells_tablet' => $image['premium_gallery_image_cell_tablet']['size'],
2251 'vcells_tablet' => $image['premium_gallery_image_vcell_tablet']['size'],
2252 'cells_mobile' => $image['premium_gallery_image_cell_mobile']['size'],
2253 'vcells_mobile' => $image['premium_gallery_image_vcell_mobile']['size'],
2254 ];
2255
2256 $this->add_render_attribute( $key, 'data-metro', wp_json_encode( $cells ) );
2257 }
2258
2259 if( $image['premium_gallery_video'] ) {
2260 $this->add_render_attribute( $key, 'class', 'premium-gallery-video-item' );
2261 }
2262
2263 ?>
2264 <div <?php echo $this->get_render_attribute_string( $key ); ?>>
2265 <div class="pa-gallery-img <?php echo esc_attr( $skin ); ?>" onclick="">
2266 <div <?php echo $this->get_render_attribute_string( 'container' ); ?>>
2267 <?php
2268 $video_link = $this->render_grid_item ( $image, $index );
2269
2270 $image['video_link'] = $video_link;
2271 if( 'style3' === $skin ) : ?>
2272 <div class="pa-gallery-icons-wrapper">
2273 <div class="pa-gallery-icons-inner-container">
2274 <?php $this->render_icons( $image, $index ); ?>
2275 </div>
2276 </div>
2277 <?php endif; ?>
2278 </div>
2279 <?php if( 'style2' !== $skin ) :
2280 if( 'default' === $skin || 'style1' === $skin ) : ?>
2281 <div class="pa-gallery-icons-wrapper">
2282 <div class="pa-gallery-icons-inner-container">
2283 <?php $this->render_icons( $image, $index ); ?>
2284 </div>
2285 </div>
2286 <?php
2287 endif;
2288 $this->render_image_caption( $image );
2289 else: ?>
2290 <div class="pa-gallery-icons-caption-container">
2291 <div class="pa-gallery-icons-caption-cell">
2292 <?php
2293 $this->render_icons( $image, $index );
2294 $this->render_image_caption( $image );
2295 ?>
2296 </div>
2297 </div>
2298 <?php endif;
2299 if( $image['premium_gallery_video'] ) : ?>
2300 </div>
2301 </div>
2302 <?php continue;
2303 endif;
2304 if( 'yes' === $image['premium_gallery_link_whole'] ) {
2305
2306 if( 'url' === $image['premium_gallery_img_link_type'] && ! empty( $image['premium_gallery_img_link']['url'] ) ) {
2307
2308 $icon_link = $image['premium_gallery_img_link']['url'];
2309 $external = $image['premium_gallery_img_link']['is_external'] ? 'target="_blank"' : '';
2310 $no_follow = $image['premium_gallery_img_link']['nofollow'] ? 'rel="nofollow"' : '';
2311
2312 ?>
2313 <a class="pa-gallery-whole-link" href="<?php echo esc_attr( $icon_link ); ?>" <?php echo $external; ?><?php echo $no_follow; ?>></a>
2314
2315 <?php } elseif( 'link' === $image['premium_gallery_img_link_type'] ) {
2316 $icon_link = get_permalink( $image['premium_gallery_img_existing'] );
2317 ?>
2318 <a class="pa-gallery-whole-link" href="<?php echo esc_attr( $icon_link ); ?>"></a>
2319 <?php }
2320
2321 } elseif ( 'yes' === $lightbox ) {
2322
2323 if( 'yes' === $image['premium_gallery_lightbox_whole'] ) {
2324
2325 $lightbox_key = 'image_lightbox_' . $index;
2326
2327 $this->add_render_attribute( $lightbox_key, [
2328 'class' => 'pa-gallery-whole-link',
2329 'href' => $image['premium_gallery_img']['url'],
2330 ]);
2331
2332 if( 'default' !== $lightbox_type ) {
2333
2334 $this->add_render_attribute( $lightbox_key, [
2335 'data-elementor-open-lightbox' => $lightbox_type,
2336 'data-elementor-lightbox-slideshow' => $this->get_id()
2337 ]);
2338
2339 if( 'yes' === $settings['lightbox_show_title'] ) {
2340
2341 $alt = Control_Media::get_image_alt( $image['premium_gallery_img'] );
2342
2343 $this->add_render_attribute( $lightbox_key, 'data-elementor-lightbox-title', $alt );
2344
2345 }
2346
2347 } else {
2348
2349 $rel = sprintf( 'prettyPhoto[premium-grid-%s]', $this->get_id() );
2350
2351 $this->add_render_attribute( $lightbox_key, [
2352 'data-rel' => $rel
2353 ]);
2354 }
2355
2356 ?>
2357
2358 <a <?php echo $this->get_render_attribute_string( $lightbox_key ); ?>></a>
2359
2360 <?php
2361 }
2362 }
2363 ?>
2364 </div>
2365 </div>
2366 <?php endforeach; ?>
2367 </div>
2368
2369 <?php if ( 'yes' === $settings['premium_gallery_load_more'] ) : ?>
2370 <div class="premium-gallery-load-more premium-gallery-btn-hidden">
2371 <button class="premium-gallery-load-more-btn">
2372 <span><?php echo $settings['premium_gallery_load_more_text']; ?></span>
2373 <div class="premium-loader"></div>
2374 </button>
2375 </div>
2376 <?php endif; ?>
2377
2378 </div>
2379
2380 <?php if ( \Elementor\Plugin::instance()->editor->is_edit_mode() ) {
2381
2382 if ( 'metro' !== $settings['premium_gallery_img_size_select'] ) {
2383 $this->render_editor_script();
2384 }
2385 } ?>
2386
2387 <?php if( 'yes' === $settings['premium_gallery_responsive_switcher'] ) : ?>
2388 <style>
2389 @media( min-width: <?php echo $min_size; ?> ) and ( max-width:<?php echo $max_size; ?> ) {
2390 #premium-img-gallery-<?php echo esc_attr( $this->get_id() ); ?> .premium-gallery-caption {
2391 display: none;
2392 }
2393 }
2394 </style>
2395 <?php endif; ?>
2396
2397 <?php }
2398
2399 /*
2400 * Render Grid Image
2401 *
2402 * Written in PHP and used to generate the final HTML for image.
2403 *
2404 * @since 3.6.4
2405 * @access protected
2406 *
2407 * @param array $item grid image repeater item
2408 * @param number $index item index
2409 */
2410 protected function render_grid_item( $item, $index ) {
2411
2412 $settings = $this->get_settings();
2413
2414 $is_video = $item['premium_gallery_video'];
2415
2416 $alt = Control_Media::get_image_alt( $item['premium_gallery_img'] );
2417
2418 $key = 'image_' . $index;
2419
2420 $image_src = $item['premium_gallery_img'];
2421 $image_src_size = Group_Control_Image_Size::get_attachment_image_src($image_src['id'], 'thumbnail', $settings);
2422
2423 $image_src = empty( $image_src_size ) ? $image_src['url'] : $image_src_size;
2424
2425 if( $is_video ) {
2426
2427 $type = $item['premium_gallery_video_type'];
2428
2429 if( 'hosted' !== $type ) {
2430 $embed_params = $this->get_embed_params( $item );
2431 $link = Embed::get_embed_url( $item['premium_gallery_video_url'], $embed_params );
2432
2433 if( empty( $image_src ) ) {
2434 $video_props = Embed::get_video_properties( $link );
2435 $id = $video_props['video_id'];
2436 $type = $video_props['provider'];
2437 $size = '';
2438 if( 'youtube' === $type ) {
2439 $size = $settings['premium_gallery_yt_thumbnail_size'];
2440 }
2441 $image_src = Helper_Functions::get_video_thumbnail( $id, $type, $size );
2442 }
2443
2444 } else {
2445 $video_params = $this->get_hosted_params( $item );
2446 }
2447
2448 }
2449
2450 $this->add_render_attribute( $key, [
2451 'class' => 'pa-gallery-image',
2452 'src' => $image_src,
2453 'alt' => $alt
2454 ]);
2455
2456 if ( $is_video ) {
2457 ?>
2458 <div class="premium-gallery-video-wrap" data-type="<?php echo $item['premium_gallery_video_type']; ?>">
2459 <?php if( 'hosted' !== $item['premium_gallery_video_type'] ) : ?>
2460 <div class="premium-gallery-iframe-wrap" data-src="<?php echo $link; ?>"></div>
2461 <?php else:
2462 $link = empty( $item['premium_gallery_video_self_url'] ) ? $item['premium_gallery_video_self']['url'] : $item['premium_gallery_video_self_url'];
2463 ?>
2464 <video src="<?php echo esc_url( $link ); ?>" <?php echo Utils::render_html_attributes( $video_params ); ?>></video>
2465 <?php endif; ?>
2466 </div>
2467 <?php } ?>
2468
2469 <img <?php echo $this->get_render_attribute_string( $key ); ?>>
2470 <?php
2471
2472 return ( isset( $link ) && ! empty ( $link ) ) ? $link : false;
2473 }
2474
2475 /*
2476 * Render Icons
2477 *
2478 * Render Lightbox and URL Icons HTML
2479 *
2480 * @since 3.6.4
2481 * @access protected
2482 *
2483 * @param array $item grid image repeater item
2484 * @param number $index item index
2485 */
2486 protected function render_icons( $item, $index ) {
2487
2488 $settings = $this->get_settings_for_display();
2489
2490 $lightbox_key = 'image_lightbox_' . $index;
2491
2492 $link_key = 'image_link_' . $index;
2493
2494 $href = $item['premium_gallery_img']['url'];
2495
2496 $lightbox = $settings['premium_gallery_light_box'];
2497
2498 $lightbox_type = $settings['premium_gallery_lightbox_type'];
2499
2500 $is_video = $item['premium_gallery_video'];
2501
2502 $id = $this->get_id();
2503
2504 if ( $is_video ) {
2505
2506 $type = $item['premium_gallery_video_type'];
2507
2508 $this->add_render_attribute( $lightbox_key, [
2509 'class' => [
2510 'pa-gallery-lightbox-wrap',
2511 'pa-gallery-video-icon'
2512 ]
2513 ]);
2514
2515 if( 'yes' === $lightbox ) {
2516
2517 $lightbox_options = [
2518 'type' => 'video',
2519 'videoType' => $item['premium_gallery_video_type'],
2520 'url' => $item['video_link'],
2521 'modalOptions' => [
2522 'id' => 'elementor-lightbox-' . $this->get_id(),
2523 'videoAspectRatio' => '169',
2524 ],
2525 ];
2526
2527 if( 'hosted' === $type ) {
2528 $lightbox_options['videoParams'] = $this->get_hosted_params( $item );
2529 }
2530
2531 $this->add_render_attribute( $lightbox_key, [
2532 'data-elementor-open-lightbox' => 'yes',
2533 'data-elementor-lightbox' => wp_json_encode( $lightbox_options ),
2534 ] );
2535
2536
2537 }
2538
2539 ?>
2540 <div <?php echo $this->get_render_attribute_string( $lightbox_key ); ?>>
2541 <a class="pa-gallery-magnific-image pa-gallery-video-icon">
2542 <span>
2543 <?php Icons_Manager::render_icon( $settings['premium_gallery_videos_icon'], [ 'aria-hidden' => 'true' ] );
2544 ?>
2545 </span>
2546 </a>
2547 </div>
2548
2549 <?php
2550 return;
2551 }
2552
2553 if( 'yes' === $lightbox ) {
2554
2555 if( 'yes' !== $item['premium_gallery_lightbox_whole'] ) {
2556
2557 $this->add_render_attribute( $lightbox_key, [
2558 'class' => 'pa-gallery-magnific-image',
2559 'href' => $href,
2560 ]);
2561
2562 if( 'default' !== $lightbox_type ) {
2563
2564 $this->add_render_attribute( $lightbox_key, [
2565 'data-elementor-open-lightbox' => $lightbox_type,
2566 'data-elementor-lightbox-slideshow' => $id
2567 ]);
2568
2569 if( 'yes' === $settings['lightbox_show_title'] ) {
2570
2571 $alt = Control_Media::get_image_alt( $item['premium_gallery_img'] );
2572
2573 $this->add_render_attribute( $lightbox_key, 'data-elementor-lightbox-title', $alt );
2574
2575 }
2576
2577 } else {
2578
2579 $rel = sprintf( 'prettyPhoto[premium-grid-%s]', $this->get_id() );
2580
2581 $this->add_render_attribute( $lightbox_key, [
2582 'data-rel' => $rel
2583 ]);
2584
2585 }
2586
2587 ?>
2588 <a <?php echo $this->get_render_attribute_string( $lightbox_key ); ?>>
2589 <span>
2590 <?php Icons_Manager::render_icon( $settings['premium_gallery_lightbox_icon'], [ 'aria-hidden' => 'true' ] );
2591 ?>
2592 </span>
2593 </a>
2594 <?php
2595 }
2596 }
2597
2598
2599 if( ! empty( $item['premium_gallery_img_link']['url'] ) || ! empty ( $item['premium_gallery_img_existing'] ) ) {
2600
2601 if( 'yes' !== $item['premium_gallery_link_whole'] ) {
2602
2603 $icon_link = '';
2604
2605 $this->add_render_attribute( $link_key, [
2606 'class' => 'pa-gallery-img-link',
2607 ]);
2608
2609 if( 'url' === $item['premium_gallery_img_link_type'] && ! empty( $item['premium_gallery_img_link']['url'] ) ) {
2610
2611 $icon_link = $item['premium_gallery_img_link']['url'];
2612
2613 $external = $item['premium_gallery_img_link']['is_external'] ? '_blank' : '';
2614
2615 $no_follow = $item['premium_gallery_img_link']['nofollow'] ? 'nofollow' : '';
2616
2617 $this->add_render_attribute( $link_key, [
2618 'href' => $icon_link,
2619 'target' => $external,
2620 'rel' => $no_follow
2621 ]);
2622
2623 } elseif( 'link' === $item['premium_gallery_img_link_type'] && ! empty( $item['premium_gallery_img_existing'] ) ) {
2624
2625 $icon_link = get_permalink( $item['premium_gallery_img_existing'] );
2626
2627 $this->add_render_attribute( $link_key, [
2628 'href' => $icon_link
2629 ]);
2630
2631 }
2632
2633 if ( ! empty ( $icon_link ) ) {
2634 ?>
2635 <a <?php echo $this->get_render_attribute_string( $link_key ); ?>>
2636 <span>
2637 <?php Icons_Manager::render_icon( $settings['premium_gallery_links_icon'], [ 'aria-hidden' => 'true' ] );
2638 ?>
2639 </span>
2640 </a>
2641 <?php
2642 }
2643 }
2644 }
2645 }
2646
2647 /*
2648 * Render Image Caption
2649 *
2650 * Written in PHP to render the final HTML for image title and description
2651 *
2652 * @since 3.6.4
2653 * @access proteced
2654 *
2655 * @param array $item grid image repeater item
2656 */
2657 protected function render_image_caption( $item ) {
2658
2659 $title = $item['premium_gallery_img_name'];
2660
2661 $description = $item['premium_gallery_img_desc'];
2662
2663 if( ! empty( $title ) || ! empty( $description ) ) : ?>
2664 <div class="premium-gallery-caption">
2665
2666 <?php if( ! empty( $title ) ) : ?>
2667 <span class="premium-gallery-img-name"><?php echo $title; ?></span>
2668 <?php endif;
2669
2670 if( ! empty( $description ) ) : ?>
2671 <p class="premium-gallery-img-desc"><?php echo $description; ?></p>
2672 <?php endif; ?>
2673
2674 </div>
2675 <?php endif;
2676 }
2677
2678 /*
2679 * Get Hosted Videos Parameters
2680 *
2681 * @since 3.7.0
2682 * @access private
2683 *
2684 * @param array $item grid image repeater item
2685 */
2686 private function get_hosted_params( $item ) {
2687
2688 $video_params = [];
2689
2690 if ( $item[ 'premium_gallery_video_controls' ] ) {
2691 $video_params[ 'controls' ] = '';
2692 }
2693
2694 if ( $item['premium_gallery_video_mute'] ) {
2695 $video_params['muted'] = 'muted';
2696 }
2697
2698 return $video_params;
2699 }
2700
2701 /*
2702 * Get embeded videos parameters
2703 *
2704 * @since 3.7.0
2705 * @access private
2706 *
2707 * @param array $item grid image repeater item
2708 */
2709 private function get_embed_params( $item ) {
2710
2711 $video_params = [];
2712
2713 $video_params[ 'controls' ] = $item[ 'premium_gallery_video_controls' ] ? '1' : '0';
2714
2715 $key = 'youtube' === $item[ 'premium_gallery_video_type' ] ? 'mute' : 'muted';
2716
2717 $video_params[ $key ] = $item['premium_gallery_video_mute'] ? '1' : '0';
2718
2719 if( 'vimeo' === $item[ 'premium_gallery_video_type' ] ) {
2720 $video_params[ 'autopause' ] = '0';
2721 }
2722
2723 return $video_params;
2724 }
2725
2726 /*
2727 * Update Controls
2728 *
2729 * @since 3.8.8
2730 * @access private
2731 *
2732 * @param array $item grid image repeater item
2733 */
2734 private function update_controls() {
2735
2736 $this->update_responsive_control( 'premium_gallery_img_border_radius',
2737 [
2738 'type' => Controls_Manager::DIMENSIONS,
2739 'selectors' => [
2740 '{{WRAPPER}} .pa-gallery-img-container, {{WRAPPER}} .pa-gallery-img:not(.style2) .pa-gallery-icons-wrapper, {{WRAPPER}} .pa-gallery-img.style2 .pa-gallery-icons-caption-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
2741 ]
2742
2743 ]
2744 );
2745
2746 $this->update_responsive_control( 'premium_gallery_content_border_radius',
2747 [
2748 'type' => Controls_Manager::DIMENSIONS,
2749 'selectors' => [
2750 '{{WRAPPER}} .premium-gallery-caption' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
2751 ]
2752
2753 ]
2754 );
2755
2756 }
2757
2758 /**
2759 * Render Editor Masonry Script.
2760 *
2761 * @since 3.12.3
2762 * @access protected
2763 */
2764 protected function render_editor_script() {
2765
2766 ?><script type="text/javascript">
2767 jQuery( document ).ready( function( $ ) {
2768
2769 $( '.premium-gallery-container' ).each( function() {
2770
2771 var $node_id = '<?php echo $this->get_id(); ?>',
2772 scope = $( '[data-id="' + $node_id + '"]' ),
2773 settings = $(this).data("settings"),
2774 selector = $(this);
2775
2776 if ( selector.closest( scope ).length < 1 ) {
2777 return;
2778 }
2779
2780 var masonryArgs = {
2781 // set itemSelector so .grid-sizer is not used in layout
2782 filter : settings.active_cat,
2783 itemSelector : '.premium-gallery-item',
2784 percentPosition : true,
2785 layoutMode : settings.img_size,
2786 };
2787
2788 var $isotopeObj = {};
2789
2790 selector.imagesLoaded( function() {
2791
2792 $isotopeObj = selector.isotope( masonryArgs );
2793
2794 selector.find('.premium-gallery-item').resize( function() {
2795 $isotopeObj.isotope( 'layout' );
2796 });
2797 });
2798
2799 });
2800 });
2801 </script>
2802 <?php
2803 }
2804 }