PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.11.77
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.11.77
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 1 month ago premium-banner.php 3 weeks ago premium-blog.php 3 weeks ago premium-button.php 3 weeks ago premium-carousel.php 3 weeks ago premium-contactform.php 3 weeks ago premium-countdown.php 3 weeks ago premium-counter.php 3 weeks ago premium-dual-header.php 3 weeks ago premium-fancytext.php 3 weeks ago premium-grid.php 3 weeks ago premium-icon-list.php 3 weeks ago premium-image-button.php 3 weeks ago premium-image-scroll.php 3 weeks ago premium-image-separator.php 3 weeks ago premium-lottie.php 3 weeks ago premium-maps.php 3 weeks ago premium-media-wheel.php 3 weeks ago premium-mobile-menu.php 3 weeks ago premium-modalbox.php 3 weeks ago premium-nav-menu.php 3 weeks ago premium-notifications.php 3 weeks ago premium-person.php 3 weeks ago premium-pinterest-feed.php 3 weeks ago premium-post-ticker.php 3 weeks ago premium-pricing-table.php 3 weeks ago premium-progressbar.php 3 weeks ago premium-search-form.php 3 weeks ago premium-svg-drawer.php 3 weeks ago premium-tcloud.php 3 weeks ago premium-testimonials.php 3 weeks ago premium-textual-showcase.php 3 weeks ago premium-tiktok-feed.php 3 weeks ago premium-title.php 3 weeks ago premium-videobox.php 3 weeks ago premium-vscroll.php 3 weeks ago premium-weather.php 3 weeks ago premium-world-clock.php 3 weeks ago
premium-grid.php
3522 lines
1 <?php
2 /**
3 * Premium Media Grid.
4 */
5
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Plugin;
10 use Elementor\Modules\DynamicTags\Module as TagsModule;
11 use Elementor\Widget_Base;
12 use Elementor\Utils;
13 use Elementor\Embed;
14 use Elementor\Control_Media;
15 use Elementor\Controls_Manager;
16 use Elementor\Icons_Manager;
17 use Elementor\Repeater;
18 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
19 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
20 use Elementor\Group_Control_Border;
21 use Elementor\Group_Control_Typography;
22 use Elementor\Group_Control_Css_Filter;
23 use Elementor\Group_Control_Text_Shadow;
24 use Elementor\Group_Control_Box_Shadow;
25 use Elementor\Group_Control_Image_Size;
26
27 // PremiumAddons Classes.
28 use PremiumAddons\Includes\Helper_Functions;
29 use PremiumAddons\Includes\Controls\Premium_Post_Filter;
30 use PremiumAddons\Includes\Controls\Premium_Background;
31
32 if ( ! defined( 'ABSPATH' ) ) {
33 exit;
34 }
35
36 /**
37 * Class Premium_Grid
38 */
39 class Premium_Grid extends Widget_Base {
40
41 /**
42 * Check for Self Hosted Videos
43 *
44 * @var is_self_hosted
45 */
46 private static $check_self_hosted = false;
47
48 /**
49 * Retrieve Widget Name.
50 *
51 * @since 1.0.0
52 * @access public
53 */
54 public function get_name() {
55 return 'premium-img-gallery';
56 }
57
58 /**
59 * Retrieve Widget Title.
60 *
61 * @since 1.0.0
62 * @access public
63 */
64 public function get_title() {
65 return __( 'Media Grid', 'premium-addons-for-elementor' );
66 }
67
68 /**
69 * Retrieve Widget Icon.
70 *
71 * @since 1.0.0
72 * @access public
73 *
74 * @return string widget icon.
75 */
76 public function get_icon() {
77 return 'pa-grid-icon';
78 }
79
80 /**
81 * Retrieve Widget Dependent CSS.
82 *
83 * @since 1.0.0
84 * @access public
85 *
86 * @return array CSS style handles.
87 */
88 public function get_style_depends() {
89 return array(
90 'pa-glass',
91 'pa-prettyphoto',
92 'e-swiper',
93 'premium-addons',
94 );
95 }
96
97 /**
98 * Retrieve Widget Dependent JS.
99 *
100 * @since 1.0.0
101 * @access public
102 *
103 * @return array JS script handles.
104 */
105 public function get_script_depends() {
106
107 $is_edit = Helper_Functions::is_edit_mode();
108
109 $scripts = array( 'imagesloaded', 'isotope-js' );
110
111 if ( $is_edit ) {
112
113 $scripts = array_merge( $scripts, array( 'pa-glass', 'prettyPhoto-js' ) );
114
115 } else {
116 $settings = $this->get_settings();
117
118 if ( 'yes' === $settings['premium_gallery_light_box'] && 'default' === $settings['premium_gallery_lightbox_type'] ) {
119 $scripts[] = 'prettyPhoto-js';
120 }
121
122 if ( 'none' !== $settings['filter_lq_effect'] ) {
123 $scripts[] = 'pa-glass';
124 }
125 }
126
127 $scripts[] = 'premium-addons';
128
129 return $scripts;
130 }
131
132 /**
133 * Widget preview refresh button.
134 *
135 * @since 1.0.0
136 * @access public
137 */
138 public function is_reload_preview_required() {
139 return true;
140 }
141
142 /**
143 * Retrieve Widget Categories.
144 *
145 * @since 1.5.1
146 * @access public
147 *
148 * @return array Widget categories.
149 */
150 public function get_categories() {
151 return array( 'premium-elements' );
152 }
153
154 /**
155 * Retrieve Widget Keywords.
156 *
157 * @since 1.0.0
158 * @access public
159 *
160 * @return string Widget keywords.
161 */
162 public function get_keywords() {
163 return array( 'pa', 'premium', 'premium media grid', 'layout', 'gallery', 'image', 'video', 'portfolio', 'visual', 'masonry', 'youtube', 'vimeo' );
164 }
165
166 protected function is_dynamic_content(): bool {
167 return false;
168 }
169
170 /**
171 * Retrieve Widget Support URL.
172 *
173 * @access public
174 *
175 * @return string support URL.
176 */
177 public function get_custom_help_url() {
178 return 'https://premiumaddons.com/support/';
179 }
180
181 public function has_widget_inner_wrapper(): bool {
182 return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' );
183 }
184
185 /**
186 * Register Media Grid controls.
187 *
188 * @since 2.1.0
189 * @access protected
190 */
191 protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
192
193 $this->start_controls_section(
194 'premium_gallery_general',
195 array(
196 'label' => __( 'Layout', 'premium-addons-for-elementor' ),
197
198 )
199 );
200
201 $demo = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-grid-widget/', 'grid', 'wp-editor', 'demo' );
202 Helper_Functions::add_templates_controls( $this, 'media-grid', $demo );
203
204 $this->add_control(
205 'premium_gallery_img_size_select',
206 array(
207 'label' => __( 'Layout', 'premium-addons-for-elementor' ),
208 'type' => Controls_Manager::SELECT,
209 'options' => array(
210 'fitRows' => __( 'Even', 'premium-addons-for-elementor' ),
211 'masonry' => __( 'Masonry', 'premium-addons-for-elementor' ),
212 'metro' => __( 'Metro', 'premium-addons-for-elementor' ),
213 ),
214 'default' => 'fitRows',
215 )
216 );
217
218 $this->add_responsive_control(
219 'pemium_gallery_even_img_height',
220 array(
221 'label' => __( 'Height', 'premium-addons-for-elementor' ),
222 'label_block' => true,
223 'size_units' => array( 'px', 'em', 'vh' ),
224 'type' => Controls_Manager::SLIDER,
225 'range' => array(
226 'px' => array(
227 'min' => 1,
228 'max' => 500,
229 ),
230 'em' => array(
231 'min' => 1,
232 'max' => 50,
233 ),
234 ),
235 'render_type' => 'template',
236 'condition' => array(
237 'premium_gallery_img_size_select' => 'fitRows',
238 ),
239 'selectors' => array(
240 '{{WRAPPER}} .pa-gallery-img-container img' => 'height: {{SIZE}}{{UNIT}}',
241 ),
242 )
243 );
244
245 $this->add_control(
246 'premium_gallery_images_fit',
247 array(
248 'label' => __( 'Images Fit', 'premium-addons-for-elementor' ),
249 'type' => Controls_Manager::SELECT,
250 'options' => array(
251 'fill' => __( 'Fill', 'premium-addons-for-elementor' ),
252 'cover' => __( 'Cover', 'premium-addons-for-elementor' ),
253 ),
254 'default' => 'fill',
255 'selectors' => array(
256 '{{WRAPPER}} .pa-gallery-img-container img' => 'object-fit: {{VALUE}}',
257 ),
258 'condition' => array(
259 'premium_gallery_img_size_select' => array( 'metro', 'fitRows' ),
260 ),
261 )
262 );
263
264 $this->add_group_control(
265 Group_Control_Image_Size::get_type(),
266 array(
267 'name' => 'thumbnail',
268 'default' => 'full',
269 )
270 );
271
272 $this->add_responsive_control(
273 'premium_gallery_column_number',
274 array(
275 'label' => __( 'Columns', 'premium-addons-for-elementor' ),
276 'label_block' => true,
277 'type' => Controls_Manager::SELECT,
278 'desktop_default' => '50%',
279 'tablet_default' => '100%',
280 'mobile_default' => '100%',
281 'options' => array(
282 '100%' => __( '1 Column', 'premium-addons-for-elementor' ),
283 '50%' => __( '2 Columns', 'premium-addons-for-elementor' ),
284 '33.330%' => __( '3 Columns', 'premium-addons-for-elementor' ),
285 '25%' => __( '4 Columns', 'premium-addons-for-elementor' ),
286 '20%' => __( '5 Columns', 'premium-addons-for-elementor' ),
287 '16.66%' => __( '6 Columns', 'premium-addons-for-elementor' ),
288 '8.33%' => __( '12 Columns', 'premium-addons-for-elementor' ),
289 ),
290 'condition' => array(
291 'premium_gallery_img_size_select!' => 'metro',
292 ),
293 'selectors' => array(
294 '{{WRAPPER}} .premium-img-gallery-masonry div.premium-gallery-item, {{WRAPPER}} .premium-img-gallery-fitRows div.premium-gallery-item' => 'width: {{VALUE}};',
295 ),
296 'render_type' => 'template',
297 )
298 );
299
300 $this->add_control(
301 'premium_gallery_load_more',
302 array(
303 'label' => __( 'Load More Button', 'premium-addons-for-elementor' ),
304 'description' => __( 'Requires number of images larger than 6', 'premium-addons-for-elementor' ),
305 'type' => Controls_Manager::SWITCHER,
306 'condition' => array(
307 'premium_gallery_shuffle_onload!' => 'yes',
308 ),
309 )
310 );
311
312 $this->add_control(
313 'premium_gallery_load_more_text',
314 array(
315 'label' => __( 'Button Text', 'premium-addons-for-elementor' ),
316 'type' => Controls_Manager::TEXT,
317 'default' => __( 'Load More', 'premium-addons-for-elementor' ),
318 'dynamic' => array( 'active' => true ),
319 'condition' => array(
320 'premium_gallery_load_more' => 'yes',
321 ),
322 'ai' => array(
323 'active' => false,
324 ),
325 )
326 );
327
328 $this->add_control(
329 'premium_gallery_load_minimum',
330 array(
331 'label' => __( 'Initial Number of Images', 'premium-addons-for-elementor' ),
332 'type' => Controls_Manager::NUMBER,
333 'description' => __( 'Set the minimum number of images before showing load more button', 'premium-addons-for-elementor' ),
334 'default' => 6,
335 'condition' => array(
336 'premium_gallery_load_more' => 'yes',
337 ),
338 )
339 );
340
341 $this->add_control(
342 'premium_gallery_load_click_number',
343 array(
344 'label' => __( 'Images to Show', 'premium-addons-for-elementor' ),
345 'type' => Controls_Manager::NUMBER,
346 'description' => __( 'Set the minimum number of images to show with each click', 'premium-addons-for-elementor' ),
347 'default' => 6,
348 'condition' => array(
349 'premium_gallery_load_more' => 'yes',
350 ),
351 )
352 );
353
354 $this->add_responsive_control(
355 'premium_gallery_load_more_align',
356 array(
357 'label' => __( 'Button Alignment', 'premium-addons-for-elementor' ),
358 'type' => Controls_Manager::CHOOSE,
359 'options' => array(
360 'left' => array(
361 'title' => __( 'Left', 'premium-addons-for-elementor' ),
362 'icon' => 'eicon-text-align-left',
363 ),
364 'center' => array(
365 'title' => __( 'Center', 'premium-addons-for-elementor' ),
366 'icon' => 'eicon-text-align-center',
367 ),
368 'right' => array(
369 'title' => __( 'Right', 'premium-addons-for-elementor' ),
370 'icon' => 'eicon-text-align-right',
371 ),
372 ),
373 'default' => 'center',
374 'selectors' => array(
375 '{{WRAPPER}} .premium-gallery-load-more' => 'text-align: {{VALUE}};',
376 ),
377 'condition' => array(
378 'premium_gallery_load_more' => 'yes',
379 ),
380 )
381 );
382
383 $this->add_control(
384 'gradient_layer',
385 array(
386 'label' => __( 'Gradient Layer', 'premium-addons-for-elementor' ),
387 'description' => __( 'Adds a gradient color on top of the grid container', 'premium-addons-for-elementor' ),
388 'type' => Controls_Manager::SWITCHER,
389 'condition' => array(
390 'premium_gallery_load_more' => 'yes',
391 ),
392 )
393 );
394
395 $this->add_group_control(
396 Premium_Background::get_type(),
397 array(
398 'name' => 'gradient_color',
399 'types' => array( 'gradient' ),
400 'selector' => '{{WRAPPER}} .premium-gallery-gradient-layer',
401 'condition' => array(
402 'premium_gallery_load_more' => 'yes',
403 'gradient_layer' => 'yes',
404 ),
405 )
406 );
407
408 $this->add_responsive_control(
409 'gradient_height',
410 array(
411 'label' => __( 'Height', 'premium-addons-for-elementor' ),
412 'label_block' => true,
413 'size_units' => array( 'px', 'em', '%', 'custom' ),
414 'type' => Controls_Manager::SLIDER,
415 'range' => array(
416 'px' => array(
417 'min' => 1,
418 'max' => 300,
419 ),
420 'em' => array(
421 'min' => 1,
422 'max' => 30,
423 ),
424 ),
425 'condition' => array(
426 'premium_gallery_load_more' => 'yes',
427 'gradient_layer' => 'yes',
428 ),
429 'selectors' => array(
430 '{{WRAPPER}} .premium-gallery-gradient-layer' => 'height: {{SIZE}}{{UNIT}}',
431 ),
432 )
433 );
434
435 $this->add_responsive_control(
436 'gradient_position',
437 array(
438 'label' => __( 'Position', 'premium-addons-for-elementor' ),
439 'label_block' => true,
440 'size_units' => array( 'px', 'em', '%', 'custom' ),
441 'type' => Controls_Manager::SLIDER,
442 'condition' => array(
443 'premium_gallery_load_more' => 'yes',
444 'gradient_layer' => 'yes',
445 ),
446 'selectors' => array(
447 '{{WRAPPER}} .premium-gallery-gradient-layer' => 'bottom: {{SIZE}}{{UNIT}}',
448 ),
449 )
450 );
451
452 $this->end_controls_section();
453
454 $this->start_controls_section(
455 'premium_gallery_cats',
456 array(
457 'label' => __( 'Categories', 'premium-addons-for-elementor' ),
458 )
459 );
460
461 $this->add_control(
462 'premium_gallery_filter',
463 array(
464 'label' => __( 'Filter Tabs', 'premium-addons-for-elementor' ),
465 'type' => Controls_Manager::SWITCHER,
466 'default' => 'yes',
467 )
468 );
469
470 $condition = array( 'premium_gallery_filter' => 'yes' );
471
472 $this->add_control(
473 'premium_gallery_first_cat_switcher',
474 array(
475 'label' => __( 'First Category', 'premium-addons-for-elementor' ),
476 'type' => Controls_Manager::SWITCHER,
477 'default' => 'yes',
478 'condition' => $condition,
479 )
480 );
481
482 $this->add_control(
483 'premium_gallery_first_cat_label',
484 array(
485 'label' => __( 'First Category Label', 'premium-addons-for-elementor' ),
486 'type' => Controls_Manager::TEXT,
487 'default' => __( 'All', 'premium-addons-for-elementor' ),
488 'dynamic' => array( 'active' => true ),
489 'condition' => array_merge(
490 array(
491 'premium_gallery_first_cat_switcher' => 'yes',
492 ),
493 $condition
494 ),
495 'ai' => array(
496 'active' => false,
497 ),
498 )
499 );
500
501 $repeater = new REPEATER();
502
503 $repeater->add_control(
504 'premium_gallery_img_cat',
505 array(
506 'label' => __( 'Category', 'premium-addons-for-elementor' ),
507 'type' => Controls_Manager::TEXT,
508 'dynamic' => array( 'active' => true ),
509 'ai' => array(
510 'active' => false,
511 ),
512 )
513 );
514
515 $repeater->add_control(
516 'premium_gallery_img_cat_rotation',
517 array(
518 'label' => __( 'Rotation Degrees', 'premium-addons-for-elementor' ),
519 'type' => Controls_Manager::NUMBER,
520 'description' => __( 'Set rotation value in degrees', 'premium-addons-for-elementor' ),
521 'min' => -180,
522 'max' => 180,
523 'selectors' => array(
524 '{{WRAPPER}} {{CURRENT_ITEM}}' => 'transform: rotate({{VALUE}}deg);',
525 ),
526 )
527 );
528
529 $this->add_control(
530 'premium_gallery_cats_content',
531 array(
532 'label' => __( 'Categories', 'premium-addons-for-elementor' ),
533 'type' => Controls_Manager::REPEATER,
534 'default' => array(
535 array(
536 'premium_gallery_img_cat' => 'Category 1',
537 ),
538 array(
539 'premium_gallery_img_cat' => 'Category 2',
540 ),
541 ),
542 'fields' => $repeater->get_controls(),
543 'title_field' => '{{{ premium_gallery_img_cat }}}',
544 'condition' => $condition,
545 )
546 );
547
548 $this->add_control(
549 'premium_gallery_active_cat',
550 array(
551 'label' => __( 'Active Category Index', 'premium-addons-for-elementor' ),
552 'type' => Controls_Manager::NUMBER,
553 'default' => 0,
554 'min' => 0,
555 'condition' => $condition,
556
557 )
558 );
559
560 $this->add_control(
561 'active_cat_notice',
562 array(
563 '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' ),
564 'type' => Controls_Manager::RAW_HTML,
565 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
566 'condition' => $condition,
567 )
568 );
569
570 $this->add_control(
571 'premium_gallery_shuffle',
572 array(
573 'label' => __( 'Shuffle Images on Filter Click', 'premium-addons-for-elementor' ),
574 'type' => Controls_Manager::SWITCHER,
575 'condition' => array_merge(
576 array(
577 'premium_gallery_filter' => 'yes',
578 ),
579 $condition
580 ),
581 )
582 );
583
584 $this->add_responsive_control(
585 'premium_gallery_filters_align',
586 array(
587 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
588 'type' => Controls_Manager::CHOOSE,
589 'options' => array(
590 'flex-start' => array(
591 'title' => __( 'Left', 'premium-addons-for-elementor' ),
592 'icon' => 'eicon-text-align-left',
593 ),
594 'center' => array(
595 'title' => __( 'Center', 'premium-addons-for-elementor' ),
596 'icon' => 'eicon-text-align-center',
597 ),
598 'flex-end' => array(
599 'title' => __( 'Right', 'premium-addons-for-elementor' ),
600 'icon' => 'eicon-text-align-right',
601 ),
602 ),
603 'default' => 'center',
604 'selectors' => array(
605 '{{WRAPPER}} .premium-img-gallery-filter' => 'justify-content: {{VALUE}}',
606 ),
607 'condition' => $condition,
608 )
609 );
610
611 $this->add_control(
612 'url_flag',
613 array(
614 'label' => __( 'URL Flag', 'premium-addons-for-elementor' ),
615 'type' => Controls_Manager::TEXT,
616 'default' => 'cat',
617 'description' => __( 'This is used to link categories from different pages. For example: premiumaddons.com/elementor-grid-widget?cat=2', 'premium-addons-for-elementor' ),
618 'label_block' => true,
619 'condition' => $condition,
620 'ai' => array(
621 'active' => false,
622 ),
623 )
624 );
625
626 $this->end_controls_section();
627
628 $this->start_controls_section(
629 'premium_gallery_content',
630 array(
631 'label' => __( 'Images/Videos', 'premium-addons-for-elementor' ),
632 )
633 );
634
635 $img_repeater = new REPEATER();
636
637 $img_repeater->add_control(
638 'premium_gallery_img',
639 array(
640 'label' => __( 'Upload Image', 'premium-addons-for-elementor' ),
641 'type' => Controls_Manager::MEDIA,
642 'dynamic' => array( 'active' => true ),
643 'default' => array(
644 'url' => Utils::get_placeholder_image_src(),
645 ),
646 )
647 );
648
649 $img_repeater->add_responsive_control(
650 'premium_gallery_image_cell',
651 array(
652 'label' => __( 'Width', 'premium-addons-for-elementor' ),
653 'description' => __( 'Works only when layout set to Metro', 'premium-addons-for-elementor' ),
654 'label_block' => true,
655 'default' => array(
656 'unit' => 'px',
657 'size' => 4,
658 ),
659 'type' => Controls_Manager::SLIDER,
660 'range' => array(
661 'px' => array(
662 'min' => 1,
663 'max' => 12,
664 ),
665 ),
666 'render_type' => 'template',
667 'frontend_available' => true,
668 )
669 );
670
671 $img_repeater->add_responsive_control(
672 'premium_gallery_image_vcell',
673 array(
674 'label' => __( 'Height', 'premium-addons-for-elementor' ),
675 'description' => __( 'Works only when layout set to \'Metro\'', 'premium-addons-for-elementor' ),
676 'label_block' => true,
677 'type' => Controls_Manager::SLIDER,
678 'default' => array(
679 'unit' => 'px',
680 'size' => 4,
681 ),
682 'range' => array(
683 'px' => array(
684 'min' => 1,
685 'max' => 12,
686 ),
687 ),
688 'render_type' => 'template',
689 'frontend_available' => true,
690 )
691 );
692
693 $img_repeater->add_control(
694 'premium_gallery_video',
695 array(
696 'label' => __( 'Video', 'premium-addons-for-elementor' ),
697 'type' => Controls_Manager::SWITCHER,
698 'return_value' => 'true',
699 )
700 );
701
702 $img_repeater->add_control(
703 'premium_gallery_video_type',
704 array(
705 'label' => __( 'Type', 'premium-addons-for-elementor' ),
706 'type' => Controls_Manager::SELECT,
707 'options' => array(
708 'youtube' => __( 'YouTube', 'premium-addons-for-elementor' ),
709 'vimeo' => __( 'Vimeo', 'premium-addons-for-elementor' ),
710 'hosted' => __( 'Self Hosted', 'premium-addons-for-elementor' ),
711 ),
712 'label_block' => true,
713 'default' => 'youtube',
714 'condition' => array(
715 'premium_gallery_video' => 'true',
716 ),
717 )
718 );
719
720 $img_repeater->add_control(
721 'premium_gallery_video_url',
722 array(
723 'label' => __( 'Video URL', 'premium-addons-for-elementor' ),
724 'type' => Controls_Manager::TEXT,
725 'label_block' => true,
726 'dynamic' => array(
727 'active' => true,
728 'categories' => array(
729 TagsModule::POST_META_CATEGORY,
730 TagsModule::URL_CATEGORY,
731 ),
732 ),
733 'condition' => array(
734 'premium_gallery_video' => 'true',
735 'premium_gallery_video_type!' => 'hosted',
736 ),
737 'ai' => array(
738 'active' => false,
739 ),
740 )
741 );
742
743 $img_repeater->add_control(
744 'premium_gallery_video_self',
745 array(
746 'label' => __( 'Select Video', 'premium-addons-for-elementor' ),
747 'type' => Controls_Manager::MEDIA,
748 'dynamic' => array(
749 'active' => true,
750 'categories' => array(
751 TagsModule::POST_META_CATEGORY,
752 TagsModule::URL_CATEGORY,
753 ),
754 ),
755 'media_type' => 'video',
756 'condition' => array(
757 'premium_gallery_video' => 'true',
758 'premium_gallery_video_type' => 'hosted',
759 ),
760 )
761 );
762
763 $img_repeater->add_control(
764 'premium_gallery_video_self_url',
765 array(
766 'label' => __( 'Remote Video URL', 'premium-addons-for-elementor' ),
767 'type' => Controls_Manager::TEXT,
768 'dynamic' => array(
769 'active' => true,
770 ),
771 'label_block' => true,
772 'condition' => array(
773 'premium_gallery_video' => 'true',
774 'premium_gallery_video_type' => 'hosted',
775 ),
776 'ai' => array(
777 'active' => false,
778 ),
779 )
780 );
781
782 $img_repeater->add_control(
783 'premium_gallery_video_controls',
784 array(
785 'label' => __( 'Controls', 'premium-addons-for-elementor' ),
786 'type' => Controls_Manager::SWITCHER,
787 'return_value' => 'true',
788 'default' => 'true',
789 'condition' => array(
790 'premium_gallery_video' => 'true',
791 ),
792 )
793 );
794
795 $img_repeater->add_control(
796 'premium_gallery_video_mute',
797 array(
798 'label' => __( 'Mute', 'premium-addons-for-elementor' ),
799 'type' => Controls_Manager::SWITCHER,
800 'return_value' => 'true',
801 'condition' => array(
802 'premium_gallery_video' => 'true',
803 ),
804 )
805 );
806
807 $img_repeater->add_control(
808 'premium_gallery_video_loop',
809 array(
810 'label' => __( 'Loop', 'premium-addons-for-elementor' ),
811 'type' => Controls_Manager::SWITCHER,
812 'return_value' => 'true',
813 'condition' => array(
814 'premium_gallery_video' => 'true',
815 ),
816 )
817 );
818
819 $img_repeater->add_control(
820 'download_button',
821 array(
822 'label' => __( 'Download Button', 'premium-addons-for-elementor' ),
823 'type' => Controls_Manager::SWITCHER,
824 'condition' => array(
825 'premium_gallery_video' => 'true',
826 'premium_gallery_video_type' => 'hosted',
827 ),
828 )
829 );
830
831 $img_repeater->add_control(
832 'privacy_mode',
833 array(
834 'label' => __( 'Privacy Mode', 'premium-addons-for-elementor' ),
835 'type' => Controls_Manager::SWITCHER,
836 'description' => __( 'When turned on, YouTube won\'t store information about visitors on your website unless they play the video.', 'premium-addons-for-elementor' ),
837 'condition' => array(
838 'premium_gallery_video' => 'true',
839 'premium_gallery_video_type' => 'youtube',
840 ),
841 )
842 );
843
844 $img_repeater->add_control(
845 'premmium_gallery_img_info',
846 array(
847 'label' => __( 'Get Title/Description From Media Library', 'premium-addons-for-elementor' ),
848 'type' => Controls_Manager::SWITCHER,
849 )
850 );
851
852 $img_repeater->add_control(
853 'premium_gallery_img_name',
854 array(
855 'label' => __( 'Title', 'premium-addons-for-elementor' ),
856 'type' => Controls_Manager::TEXT,
857 'dynamic' => array( 'active' => true ),
858 'label_block' => true,
859 'condition' => array(
860 'premmium_gallery_img_info!' => 'yes',
861 ),
862 'ai' => array(
863 'active' => false,
864 ),
865 )
866 );
867
868 $img_repeater->add_control(
869 'premium_gallery_img_desc',
870 array(
871 'label' => __( 'Description', 'premium-addons-for-elementor' ),
872 'type' => Controls_Manager::TEXTAREA,
873 'dynamic' => array( 'active' => true ),
874 'label_block' => true,
875 'condition' => array(
876 'premmium_gallery_img_info!' => 'yes',
877 ),
878 'ai' => array(
879 'active' => false,
880 ),
881 )
882 );
883
884 $img_repeater->add_control(
885 'premium_gallery_img_category',
886 array(
887 'label' => __( 'Category', 'premium-addons-for-elementor' ),
888 'type' => Controls_Manager::TEXT,
889 'description' => __( 'To assign for multiple categories, separate by a comma \',\'', 'premium-addons-for-elementor' ),
890 'dynamic' => array( 'active' => true ),
891 'ai' => array(
892 'active' => false,
893 ),
894 )
895 );
896
897 $img_repeater->add_control(
898 'premium_gallery_img_link_type',
899 array(
900 'label' => __( 'Link Type', 'premium-addons-for-elementor' ),
901 'type' => Controls_Manager::SELECT,
902 'options' => array(
903 'url' => __( 'URL', 'premium-addons-for-elementor' ),
904 'link' => __( 'Existing Page', 'premium-addons-for-elementor' ),
905 ),
906 'default' => 'url',
907 'label_block' => true,
908 'condition' => array(
909 'premium_gallery_video!' => 'true',
910 ),
911 )
912 );
913
914 $img_repeater->add_control(
915 'premium_gallery_img_link',
916 array(
917 'label' => __( 'Link', 'premium-addons-for-elementor' ),
918 'type' => Controls_Manager::URL,
919 'dynamic' => array( 'active' => true ),
920 'placeholder' => 'https://premiumaddons.com/',
921 'label_block' => true,
922 'condition' => array(
923 'premium_gallery_img_link_type' => 'url',
924 'premium_gallery_video!' => 'true',
925 ),
926 )
927 );
928
929 $img_repeater->add_control(
930 'premium_gallery_img_existing',
931 array(
932 'label' => __( 'Existing Page', 'premium-addons-for-elementor' ),
933 'type' => Premium_Post_Filter::TYPE,
934 'label_block' => true,
935 'multiple' => false,
936 'separator' => 'after',
937 'source' => array( 'post', 'page' ),
938 'condition' => array(
939 'premium_gallery_img_link_type' => 'link',
940 'premium_gallery_video!' => 'true',
941 ),
942 )
943 );
944
945 $img_repeater->add_control(
946 'premium_gallery_link_whole',
947 array(
948 'label' => __( 'Whole Image Link', 'premium-addons-for-elementor' ),
949 'type' => Controls_Manager::SWITCHER,
950 'condition' => array(
951 'premium_gallery_video!' => 'true',
952 ),
953 )
954 );
955
956 $img_repeater->add_control(
957 'premium_gallery_lightbox_whole',
958 array(
959 'label' => __( 'Whole Image Lightbox', 'premium-addons-for-elementor' ),
960 'type' => Controls_Manager::SWITCHER,
961 'condition' => array(
962 'premium_gallery_video!' => 'true',
963 ),
964 )
965 );
966
967 $this->add_control(
968 'premium_gallery_img_content',
969 array(
970 'label' => __( 'Images', 'premium-addons-for-elementor' ),
971 'type' => Controls_Manager::REPEATER,
972 'default' => array(
973 array(
974 'premium_gallery_img_name' => 'Image #1',
975 'premium_gallery_img_category' => 'Category 1',
976 ),
977 array(
978 'premium_gallery_img_name' => 'Image #2',
979 'premium_gallery_img_category' => 'Category 2',
980 ),
981 ),
982 'frontend_available' => true,
983 'fields' => $img_repeater->get_controls(),
984 'title_field' => '{{{ "" !== premium_gallery_img_name ? premium_gallery_img_name : "Image" }}} - {{{ "" !== premium_gallery_img_category ? premium_gallery_img_category : "No Categories" }}}',
985 )
986 );
987
988 $this->add_control(
989 'premium_gallery_shuffle_onload',
990 array(
991 'label' => __( 'Shuffle Images on Page Load', 'premium-addons-for-elementor' ),
992 'type' => Controls_Manager::SWITCHER,
993 'condition' => array(
994 'premium_gallery_load_more!' => 'yes',
995 ),
996 )
997 );
998
999 $this->add_control(
1000 'premium_gallery_yt_thumbnail_size',
1001 array(
1002 'label' => __( 'Youtube Videos Thumbnail Size', 'premium-addons-for-elementor' ),
1003 'type' => Controls_Manager::SELECT,
1004 'options' => array(
1005 'maxresdefault' => __( 'Maximum Resolution', 'premium-addons-for-elementor' ),
1006 'hqdefault' => __( 'High Quality', 'premium-addons-for-elementor' ),
1007 'mqdefault' => __( 'Medium Quality', 'premium-addons-for-elementor' ),
1008 'sddefault' => __( 'Standard Quality', 'premium-addons-for-elementor' ),
1009 ),
1010 'default' => 'maxresdefault',
1011 'label_block' => true,
1012 )
1013 );
1014
1015 $this->end_controls_section();
1016
1017 $this->start_controls_section(
1018 'premium_gallery_grid_settings',
1019 array(
1020 'label' => __( 'Display Options', 'premium-addons-for-elementor' ),
1021
1022 )
1023 );
1024
1025 $this->add_responsive_control(
1026 'premium_gallery_gap',
1027 array(
1028 'label' => __( 'Image Gap', 'premium-addons-for-elementor' ),
1029 'type' => Controls_Manager::SLIDER,
1030 'size_units' => array( 'px', '%', 'em' ),
1031 'range' => array(
1032 'px' => array(
1033 'min' => 0,
1034 'max' => 200,
1035 ),
1036 ),
1037 'selectors' => array(
1038 '{{WRAPPER}} .premium-gallery-item' => 'padding: {{SIZE}}{{UNIT}}',
1039 ),
1040 )
1041 );
1042
1043 $this->add_control(
1044 'premium_gallery_img_style',
1045 array(
1046 'label' => __( 'Skin', 'premium-addons-for-elementor' ),
1047 'type' => Controls_Manager::SELECT,
1048 'description' => __( 'Choose a layout style for the gallery', 'premium-addons-for-elementor' ),
1049 'options' => array(
1050 'default' => __( 'Style 1', 'premium-addons-for-elementor' ),
1051 'style1' => __( 'Style 2', 'premium-addons-for-elementor' ),
1052 'style2' => __( 'Style 3', 'premium-addons-for-elementor' ),
1053 'style3' => __( 'Style 4', 'premium-addons-for-elementor' ),
1054 ),
1055 'default' => 'default',
1056 'separator' => 'before',
1057 'label_block' => true,
1058 )
1059 );
1060
1061 $this->add_control(
1062 'style_notice',
1063 array(
1064 'raw' => __( 'You need to make sure that the grid items have title/description to see the skins.', 'premium-addons-for-elementor' ),
1065 'type' => Controls_Manager::RAW_HTML,
1066 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
1067 )
1068 );
1069
1070 $this->add_control(
1071 'premium_grid_style_notice',
1072 array(
1073 'raw' => __( 'Style 4 works only with Even / Masonry Layout', 'premium-addons-for-elementor' ),
1074 'type' => Controls_Manager::RAW_HTML,
1075 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
1076 'condition' => array(
1077 'premium_gallery_img_style' => 'style3',
1078 'premium_gallery_img_size_select' => 'metro',
1079 ),
1080 )
1081 );
1082
1083 $this->add_responsive_control(
1084 'premium_gallery_style1_border_border',
1085 array(
1086 'label' => __( 'Height', 'premium-addons-for-elementor' ),
1087 'type' => Controls_Manager::SLIDER,
1088 'range' => array(
1089 'px' => array(
1090 'min' => 0,
1091 'max' => 700,
1092 ),
1093 ),
1094 'label_block' => true,
1095 'selectors' => array(
1096 '{{WRAPPER}} .pa-gallery-img.style1 .premium-gallery-caption' => 'bottom: {{SIZE}}px;',
1097 ),
1098 'condition' => array(
1099 'premium_gallery_img_style' => 'style1',
1100 ),
1101 )
1102 );
1103
1104 $this->add_control(
1105 'premium_gallery_img_effect',
1106 array(
1107 'label' => __( 'Hover Effect', 'premium-addons-for-elementor' ),
1108 'type' => Controls_Manager::SELECT,
1109 'description' => __( 'Choose a hover effect for the image', 'premium-addons-for-elementor' ),
1110 'options' => array(
1111 'none' => __( 'None', 'premium-addons-for-elementor' ),
1112 'zoomin' => __( 'Zoom In', 'premium-addons-for-elementor' ),
1113 'zoomout' => __( 'Zoom Out', 'premium-addons-for-elementor' ),
1114 'scale' => __( 'Scale', 'premium-addons-for-elementor' ),
1115 'gray' => __( 'Grayscale', 'premium-addons-for-elementor' ),
1116 'blur' => __( 'Blur', 'premium-addons-for-elementor' ),
1117 'bright' => __( 'Bright', 'premium-addons-for-elementor' ),
1118 'sepia' => __( 'Sepia', 'premium-addons-for-elementor' ),
1119 'trans' => __( 'Translate', 'premium-addons-for-elementor' ),
1120 ),
1121 'default' => 'zoomin',
1122 'label_block' => true,
1123 'separator' => 'after',
1124 )
1125 );
1126
1127 $this->add_control(
1128 'premium_gallery_links_icon',
1129 array(
1130 'label' => __( 'Links Icon', 'premium-addons-for-elementor' ),
1131 'type' => Controls_Manager::ICONS,
1132 'default' => array(
1133 'library' => 'fa-solid',
1134 'value' => 'fas fa-link',
1135 ),
1136 )
1137 );
1138
1139 $this->add_control(
1140 'premium_gallery_videos_heading',
1141 array(
1142 'label' => __( 'Videos', 'premium-addons-for-elementor' ),
1143 'type' => Controls_Manager::HEADING,
1144 'separator' => 'before',
1145 )
1146 );
1147
1148 $this->add_control(
1149 'premium_gallery_video_icon',
1150 array(
1151 'label' => __( 'Always Show Play Icon', 'premium-addons-for-elementor' ),
1152 'type' => Controls_Manager::SWITCHER,
1153 'return_value' => 'true',
1154 'default' => 'true',
1155 'condition' => array(
1156 'premium_gallery_img_style!' => 'style2',
1157 ),
1158
1159 )
1160 );
1161
1162 $this->add_control(
1163 'premium_gallery_videos_icon',
1164 array(
1165 'label' => __( 'Videos Play Icon', 'premium-addons-for-elementor' ),
1166 'type' => Controls_Manager::ICONS,
1167 'default' => array(
1168 'library' => 'fa-solid',
1169 'value' => 'fas fa-play',
1170 ),
1171 )
1172 );
1173
1174 $this->add_control(
1175 'premium_gallery_rtl_mode',
1176 array(
1177 'label' => __( 'RTL Mode', 'premium-addons-for-elementor' ),
1178 'description' => __( 'This option moves the origin of the grid to the right side. Useful for RTL direction sites', 'premium-addons-for-elementor' ),
1179 'type' => Controls_Manager::SWITCHER,
1180 'separator' => 'before',
1181 )
1182 );
1183
1184 $this->add_responsive_control(
1185 'premium_gallery_content_align',
1186 array(
1187 'label' => __( 'Content Alignment', 'premium-addons-for-elementor' ),
1188 'type' => Controls_Manager::CHOOSE,
1189 'options' => array(
1190 'left' => array(
1191 'title' => __( 'Left', 'premium-addons-for-elementor' ),
1192 'icon' => 'eicon-text-align-left',
1193 ),
1194 'center' => array(
1195 'title' => __( 'Center', 'premium-addons-for-elementor' ),
1196 'icon' => 'eicon-text-align-center',
1197 ),
1198 'right' => array(
1199 'title' => __( 'Right', 'premium-addons-for-elementor' ),
1200 'icon' => 'eicon-text-align-right',
1201 ),
1202 ),
1203 'default' => 'center',
1204 'separator' => 'before',
1205 'selectors' => array(
1206 '{{WRAPPER}} .premium-gallery-caption' => 'text-align: {{VALUE}};',
1207 ),
1208 )
1209 );
1210
1211 $this->end_controls_section();
1212
1213 $this->start_controls_section(
1214 'premium_gallery_lightbox_section',
1215 array(
1216 'label' => __( 'Lightbox', 'premium-addons-for-elementor' ),
1217 )
1218 );
1219
1220 $this->add_control(
1221 'premium_gallery_light_box',
1222 array(
1223 'label' => __( 'Lightbox', 'premium-addons-for-elementor' ),
1224 'type' => Controls_Manager::SWITCHER,
1225 'default' => 'yes',
1226 'separator' => 'before',
1227 )
1228 );
1229
1230 $this->add_control(
1231 'premium_gallery_lightbox_type',
1232 array(
1233 'label' => __( 'Lightbox Style', 'premium-addons-for-elementor' ),
1234 'type' => Controls_Manager::SELECT,
1235 'default' => 'default',
1236 'options' => array(
1237 'default' => __( 'PrettyPhoto', 'premium-addons-for-elementor' ),
1238 'yes' => __( 'Elementor', 'premium-addons-for-elementor' ),
1239 'no' => __( 'Other Lightbox Plugin', 'premium-addons-for-elementor' ),
1240 ),
1241 'condition' => array(
1242 'premium_gallery_light_box' => 'yes',
1243 ),
1244 )
1245 );
1246
1247 $this->add_control(
1248 'lightbox_show_title',
1249 array(
1250 'label' => __( 'Show Image Title', 'premium-addons-for-elementor' ),
1251 'type' => Controls_Manager::SWITCHER,
1252 'default' => 'yes',
1253 'condition' => array(
1254 'premium_gallery_light_box' => 'yes',
1255 'premium_gallery_lightbox_type' => 'yes',
1256 ),
1257 )
1258 );
1259
1260 $this->add_control(
1261 'premium_gallery_lightbox_theme',
1262 array(
1263 'label' => __( 'Lightbox Theme', 'premium-addons-for-elementor' ),
1264 'type' => Controls_Manager::SELECT,
1265 'options' => array(
1266 'pp_default' => __( 'Default', 'premium-addons-for-elementor' ),
1267 'light_rounded' => __( 'Light Rounded', 'premium-addons-for-elementor' ),
1268 'dark_rounded' => __( 'Dark Rounded', 'premium-addons-for-elementor' ),
1269 'light_square' => __( 'Light Square', 'premium-addons-for-elementor' ),
1270 'dark_square' => __( 'Dark Square', 'premium-addons-for-elementor' ),
1271 'facebook' => __( 'Facebook', 'premium-addons-for-elementor' ),
1272 ),
1273 'default' => 'pp_default',
1274 'condition' => array(
1275 'premium_gallery_light_box' => 'yes',
1276 'premium_gallery_lightbox_type' => 'default',
1277 ),
1278 )
1279 );
1280
1281 $this->add_control(
1282 'premium_gallery_overlay_gallery',
1283 array(
1284 'label' => __( 'Overlay Gallery Images', 'premium-addons-for-elementor' ),
1285 'type' => Controls_Manager::SWITCHER,
1286 'condition' => array(
1287 'premium_gallery_light_box' => 'yes',
1288 'premium_gallery_lightbox_type' => 'default',
1289 ),
1290 )
1291 );
1292
1293 $this->add_control(
1294 'premium_gallery_lightbox_icon',
1295 array(
1296 'label' => __( 'Lightbox Icon', 'premium-addons-for-elementor' ),
1297 'type' => Controls_Manager::ICONS,
1298 'default' => array(
1299 'library' => 'fa-solid',
1300 'value' => 'fas fa-search',
1301 ),
1302 'condition' => array(
1303 'premium_gallery_light_box' => 'yes',
1304 ),
1305 )
1306 );
1307
1308 $this->end_controls_section();
1309
1310 $this->start_controls_section(
1311 'premium_gallery_responsive_section',
1312 array(
1313 'label' => __( 'Responsive', 'premium-addons-for-elementor' ),
1314 )
1315 );
1316
1317 $this->add_control(
1318 'premium_gallery_responsive_switcher',
1319 array(
1320 'label' => __( 'Responsive Controls', 'premium-addons-for-elementor' ),
1321 'type' => Controls_Manager::SWITCHER,
1322 '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' ),
1323 )
1324 );
1325
1326 $this->add_control(
1327 'premium_gallery_min_range',
1328 array(
1329 'label' => __( 'Minimum Size', 'premium-addons-for-elementor' ),
1330 'type' => Controls_Manager::NUMBER,
1331 'description' => __( 'Note: minimum size for extra small screens is 1px.', 'premium-addons-for-elementor' ),
1332 'default' => 1,
1333 'condition' => array(
1334 'premium_gallery_responsive_switcher' => 'yes',
1335 ),
1336 )
1337 );
1338
1339 $this->add_control(
1340 'premium_gallery_max_range',
1341 array(
1342 'label' => __( 'Maximum Size', 'premium-addons-for-elementor' ),
1343 'type' => Controls_Manager::NUMBER,
1344 'description' => __( 'Note: maximum size for extra small screens is 767px.', 'premium-addons-for-elementor' ),
1345 'default' => 767,
1346 'condition' => array(
1347 'premium_gallery_responsive_switcher' => 'yes',
1348 ),
1349 )
1350 );
1351
1352 $this->end_controls_section();
1353
1354 $this->start_controls_section(
1355 'section_pa_docs',
1356 array(
1357 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ),
1358 )
1359 );
1360
1361 $docs = array(
1362 'https://premiumaddons.com/docs/grid-widget-tutorial' => __( 'Getting started »', 'premium-addons-for-elementor' ),
1363 'https://premiumaddons.com/docs/how-to-assign-an-image-to-multiple-categories' => __( 'How to assign a grid item to multiple categories »', 'premium-addons-for-elementor' ),
1364 'https://premiumaddons.com/docs/how-to-link-categories-in-elementor-gallery-widget/' => __( 'How To Link Categories In Media Grid Widget »', 'premium-addons-for-elementor' ),
1365 '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 »', 'premium-addons-for-elementor' ),
1366 'https://premiumaddons.com/docs/how-to-solve-media-grid-and-tabs-widgets-conflict/' => __( 'How to Solve Media Grid and Tabs Widgets Conflict »', 'premium-addons-for-elementor' ),
1367 );
1368
1369 $doc_index = 1;
1370 foreach ( $docs as $url => $title ) {
1371
1372 $doc_url = Helper_Functions::get_campaign_link( $url, 'grid-widget', 'wp-editor', 'get-support' );
1373
1374 $this->add_control(
1375 'doc_' . $doc_index,
1376 array(
1377 'type' => Controls_Manager::RAW_HTML,
1378 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ),
1379 'content_classes' => 'editor-pa-doc',
1380 )
1381 );
1382
1383 ++$doc_index;
1384
1385 }
1386
1387 Helper_Functions::register_element_feedback_controls( $this );
1388
1389 $this->end_controls_section();
1390
1391 Helper_Functions::register_papro_promotion_controls( $this, 'grid' );
1392
1393 $this->start_controls_section(
1394 'premium_gallery_img_style_section',
1395 array(
1396 'label' => __( 'Image', 'premium-addons-for-elementor' ),
1397 'tab' => Controls_Manager::TAB_STYLE,
1398 )
1399 );
1400
1401 $this->add_control(
1402 'premium_gallery_icons_style_overlay',
1403 array(
1404 'label' => __( 'Hover Overlay Color', 'premium-addons-for-elementor' ),
1405 'type' => Controls_Manager::COLOR,
1406 'selectors' => array(
1407 '{{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}};',
1408 ),
1409 )
1410 );
1411
1412 $this->add_group_control(
1413 Group_Control_Border::get_type(),
1414 array(
1415 'name' => 'premium_gallery_img_border',
1416 'selector' => '{{WRAPPER}} .pa-gallery-img-container',
1417 )
1418 );
1419
1420 $this->add_control(
1421 'premium_gallery_img_border_radius',
1422 array(
1423 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1424 'type' => Controls_Manager::DIMENSIONS,
1425 'size_units' => array( 'px', '%', 'em' ),
1426 'selectors' => array(
1427 '{{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}}',
1428 ),
1429 )
1430 );
1431
1432 $this->add_group_control(
1433 Group_Control_Box_Shadow::get_type(),
1434 array(
1435 'label' => __( 'Shadow', 'premium-addons-for-elementor' ),
1436 'name' => 'premium_gallery_img_box_shadow',
1437 'selector' => '{{WRAPPER}} .pa-gallery-img-container',
1438 'condition' => array(
1439 'premium_gallery_img_style!' => 'style1',
1440 ),
1441 )
1442 );
1443
1444 $this->add_group_control(
1445 Group_Control_Css_Filter::get_type(),
1446 array(
1447 'name' => 'css_filters',
1448 'selector' => '{{WRAPPER}} .pa-gallery-img-container img',
1449 )
1450 );
1451
1452 $this->add_group_control(
1453 Group_Control_Css_Filter::get_type(),
1454 array(
1455 'label' => __( 'Hover CSS Filters', 'premium-addons-for-elementor' ),
1456 'name' => 'hover_css_filters',
1457 'selector' => '{{WRAPPER}} .premium-gallery-item:hover img',
1458 )
1459 );
1460
1461 $this->add_responsive_control(
1462 'premium_gallery_img_margin',
1463 array(
1464 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1465 'type' => Controls_Manager::DIMENSIONS,
1466 'size_units' => array( 'px', 'em', '%' ),
1467 'selectors' => array(
1468 '{{WRAPPER}} .pa-gallery-img-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1469 ),
1470 )
1471 );
1472
1473 $this->add_responsive_control(
1474 'premium_gallery_img_padding',
1475 array(
1476 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1477 'type' => Controls_Manager::DIMENSIONS,
1478 'size_units' => array( 'px', 'em', '%' ),
1479 'selectors' => array(
1480 '{{WRAPPER}} .pa-gallery-img-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1481 ),
1482 )
1483 );
1484
1485 $this->end_controls_section();
1486
1487 $this->start_controls_section(
1488 'premium_gallery_content_style',
1489 array(
1490 'label' => __( 'Title / Description', 'premium-addons-for-elementor' ),
1491 'tab' => Controls_Manager::TAB_STYLE,
1492 )
1493 );
1494
1495 $this->add_control(
1496 'premium_gallery_title_heading',
1497 array(
1498 'label' => __( 'Title', 'premium-addons-for-elementor' ),
1499 'type' => Controls_Manager::HEADING,
1500 )
1501 );
1502
1503 $this->add_control(
1504 'premium_gallery_title_color',
1505 array(
1506 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1507 'type' => Controls_Manager::COLOR,
1508 'global' => array(
1509 'default' => Global_Colors::COLOR_SECONDARY,
1510 ),
1511 'selectors' => array(
1512 '{{WRAPPER}} .premium-gallery-img-name, {{WRAPPER}} .premium-gallery-img-name a' => 'color: {{VALUE}};',
1513 ),
1514 )
1515 );
1516
1517 $this->add_group_control(
1518 Group_Control_Typography::get_type(),
1519 array(
1520 'name' => 'premium_gallery_title_typo',
1521 'global' => array(
1522 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
1523 ),
1524 'selector' => '{{WRAPPER}} .premium-gallery-img-name, {{WRAPPER}} .premium-gallery-img-name a',
1525 )
1526 );
1527
1528 $this->add_responsive_control(
1529 'title_spacing',
1530 array(
1531 'label' => __( 'Spacing', 'premium-addons-for-elementor' ),
1532 'type' => Controls_Manager::SLIDER,
1533 'selectors' => array(
1534 '{{WRAPPER}} .premium-gallery-img-name' => 'margin-bottom: {{SIZE}}px',
1535 ),
1536 )
1537 );
1538
1539 $this->add_control(
1540 'premium_gallery_description_heading',
1541 array(
1542 'label' => __( 'Description', 'premium-addons-for-elementor' ),
1543 'type' => Controls_Manager::HEADING,
1544 'separator' => 'before',
1545 )
1546 );
1547
1548 $this->add_control(
1549 'premium_gallery_description_color',
1550 array(
1551 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1552 'type' => Controls_Manager::COLOR,
1553 'global' => array(
1554 'default' => Global_Colors::COLOR_TEXT,
1555 ),
1556 'selectors' => array(
1557 '{{WRAPPER}} .premium-gallery-img-desc, {{WRAPPER}} .premium-gallery-img-desc a' => 'color: {{VALUE}};',
1558 ),
1559 )
1560 );
1561
1562 $this->add_group_control(
1563 Group_Control_Typography::get_type(),
1564 array(
1565 'name' => 'premium_gallery_description_typo',
1566 'global' => array(
1567 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
1568 ),
1569 'selector' => '{{WRAPPER}} .premium-gallery-img-desc, {{WRAPPER}} .premium-gallery-img-desc a',
1570 )
1571 );
1572
1573 $this->add_control(
1574 'container_heading',
1575 array(
1576 'label' => __( 'Container', 'premium-addons-for-elementor' ),
1577 'type' => Controls_Manager::HEADING,
1578 'separator' => 'before',
1579 )
1580 );
1581
1582 $this->add_group_control(
1583 Group_Control_Text_Shadow::get_type(),
1584 array(
1585 'label' => __( 'Text Shadow', 'premium-addons-for-elementor' ),
1586 'name' => 'premium_gallery_content_shadow',
1587 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1588 )
1589 );
1590
1591 $this->add_group_control(
1592 Group_Control_Box_Shadow::get_type(),
1593 array(
1594 'name' => 'premium_gallery_content_box_shadow',
1595 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1596 )
1597 );
1598
1599 $this->add_group_control(
1600 Premium_Background::get_type(),
1601 array(
1602 'name' => 'premium_gallery_content_background',
1603 'types' => array( 'classic', 'gradient' ),
1604 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1605 )
1606 );
1607
1608 $this->add_group_control(
1609 Group_Control_Border::get_type(),
1610 array(
1611 'name' => 'premium_gallery_content_border',
1612 'selector' => '{{WRAPPER}} .premium-gallery-caption',
1613 )
1614 );
1615
1616 $this->add_control(
1617 'premium_gallery_content_border_radius',
1618 array(
1619 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1620 'type' => Controls_Manager::DIMENSIONS,
1621 'size_units' => array( 'px', '%', 'em' ),
1622 'selectors' => array(
1623 '{{WRAPPER}} .premium-gallery-caption' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1624 ),
1625 )
1626 );
1627
1628 $this->add_responsive_control(
1629 'premium_gallery_content_margin',
1630 array(
1631 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1632 'type' => Controls_Manager::DIMENSIONS,
1633 'size_units' => array( 'px', 'em', '%' ),
1634 'selectors' => array(
1635 '{{WRAPPER}} .premium-gallery-caption' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
1636 ),
1637 )
1638 );
1639
1640 $this->end_controls_section();
1641
1642 $this->start_controls_section(
1643 'premium_gallery_icons_style',
1644 array(
1645 'label' => __( 'Icons', 'premium-addons-for-elementor' ),
1646 'tab' => Controls_Manager::TAB_STYLE,
1647 )
1648 );
1649
1650 $this->add_responsive_control(
1651 'premium_gallery_style1_icons_position',
1652 array(
1653 'label' => __( 'Position', 'premium-addons-for-elementor' ),
1654 'type' => Controls_Manager::SLIDER,
1655 'size_units' => array( 'px', '%', 'em', 'custom' ),
1656 'range' => array(
1657 'px' => array(
1658 'min' => 0,
1659 'max' => 300,
1660 ),
1661 ),
1662 'label_block' => true,
1663 'selectors' => array(
1664 '{{WRAPPER}} .pa-gallery-img:not(.style2) .pa-gallery-icons-inner-container' => 'top: {{SIZE}}{{UNIT}};',
1665 ),
1666 'condition' => array(
1667 'premium_gallery_img_style!' => 'style2',
1668 ),
1669 )
1670 );
1671
1672 $this->add_responsive_control(
1673 'premium_gallery_icons_size',
1674 array(
1675 'label' => __( 'Size', 'premium-addons-for-elementor' ),
1676 'type' => Controls_Manager::SLIDER,
1677 'size_units' => array( 'px', 'em' ),
1678 'range' => array(
1679 'px' => array(
1680 'min' => 1,
1681 'max' => 50,
1682 ),
1683 ),
1684 'label_block' => true,
1685 'selectors' => array(
1686 '{{WRAPPER}} .pa-gallery-icons-inner-container i, {{WRAPPER}} .pa-gallery-icons-caption-cell i' => 'font-size: {{SIZE}}{{UNIT}}',
1687 '{{WRAPPER}} .pa-gallery-icons-inner-container svg, {{WRAPPER}} .pa-gallery-icons-caption-cell svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}',
1688 ),
1689 )
1690 );
1691
1692 $this->start_controls_tabs( 'premium_gallery_icons_style_tabs' );
1693
1694 $this->start_controls_tab(
1695 'premium_gallery_icons_style_normal',
1696 array(
1697 'label' => __( 'Normal', 'premium-addons-for-elementor' ),
1698 )
1699 );
1700
1701 $this->add_control(
1702 'premium_gallery_icons_style_color',
1703 array(
1704 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1705 'type' => Controls_Manager::COLOR,
1706 'global' => array(
1707 'default' => Global_Colors::COLOR_PRIMARY,
1708 ),
1709 'selectors' => array(
1710 '{{WRAPPER}} .pa-gallery-magnific-image i, {{WRAPPER}} .pa-gallery-img-link i' => 'color: {{VALUE}};',
1711 '{{WRAPPER}} .pa-gallery-magnific-image svg, {{WRAPPER}} .pa-gallery-img-link svg' => 'fill: {{VALUE}}; color: {{VALUE}}',
1712 ),
1713 )
1714 );
1715
1716 $this->add_control(
1717 'premium_gallery_icons_style_background',
1718 array(
1719 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1720 'type' => Controls_Manager::COLOR,
1721 'global' => array(
1722 'default' => Global_Colors::COLOR_SECONDARY,
1723 ),
1724 'selectors' => array(
1725 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'background-color: {{VALUE}};',
1726 ),
1727 )
1728 );
1729
1730 $this->add_group_control(
1731 Group_Control_Border::get_type(),
1732 array(
1733 'name' => 'premium_gallery_icons_style_border',
1734 'selector' => '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span',
1735 )
1736 );
1737
1738 $this->add_control(
1739 'premium_gallery_icons_style_border_radius',
1740 array(
1741 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1742 'type' => Controls_Manager::SLIDER,
1743 'size_units' => array( 'px', 'em', '%' ),
1744 'selectors' => array(
1745 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'border-radius: {{SIZE}}{{UNIT}};',
1746 ),
1747 )
1748 );
1749
1750 $this->add_group_control(
1751 Group_Control_Box_Shadow::get_type(),
1752 array(
1753 'label' => __( 'Shadow', 'premium-addons-for-elementor' ),
1754 'name' => 'premium_gallery_icons_style_shadow',
1755 'selector' => '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span',
1756 )
1757 );
1758
1759 $this->add_responsive_control(
1760 'premium_gallery_icons_style_margin',
1761 array(
1762 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1763 'type' => Controls_Manager::DIMENSIONS,
1764 'size_units' => array( 'px', 'em', '%' ),
1765 'selectors' => array(
1766 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1767 ),
1768 )
1769 );
1770
1771 $this->add_responsive_control(
1772 'premium_gallery_icons_style_padding',
1773 array(
1774 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1775 'type' => Controls_Manager::DIMENSIONS,
1776 'size_units' => array( 'px', 'em', '%' ),
1777 'selectors' => array(
1778 '{{WRAPPER}} .pa-gallery-magnific-image span, {{WRAPPER}} .pa-gallery-img-link span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1779 ),
1780 )
1781 );
1782
1783 $this->end_controls_tab();
1784
1785 $this->start_controls_tab(
1786 'premium_gallery_icons_style_hover',
1787 array(
1788 'label' => __( 'Hover', 'premium-addons-for-elementor' ),
1789 )
1790 );
1791
1792 $this->add_control(
1793 'premium_gallery_icons_style_color_hover',
1794 array(
1795 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1796 'type' => Controls_Manager::COLOR,
1797 'global' => array(
1798 'default' => Global_Colors::COLOR_PRIMARY,
1799 ),
1800 'selectors' => array(
1801 '{{WRAPPER}} .pa-gallery-magnific-image:hover i, {{WRAPPER}} .pa-gallery-img-link:hover i' => 'color: {{VALUE}}',
1802 '{{WRAPPER}} .pa-gallery-magnific-image:hover svg, {{WRAPPER}} .pa-gallery-img-link:hover svg' => 'fill: {{VALUE}}; color: {{VALUE}}',
1803 ),
1804 )
1805 );
1806
1807 $this->add_control(
1808 'premium_gallery_icons_style_background_hover',
1809 array(
1810 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1811 'type' => Controls_Manager::COLOR,
1812 'global' => array(
1813 'default' => Global_Colors::COLOR_SECONDARY,
1814 ),
1815 'selectors' => array(
1816 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'background-color: {{VALUE}};',
1817 ),
1818 )
1819 );
1820
1821 $this->add_group_control(
1822 Group_Control_Border::get_type(),
1823 array(
1824 'name' => 'premium_gallery_icons_style_border_hover',
1825 'selector' => '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span',
1826 )
1827 );
1828
1829 $this->add_control(
1830 'premium_gallery_icons_style_border_radius_hover',
1831 array(
1832 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1833 'type' => Controls_Manager::SLIDER,
1834 'size_units' => array( 'px', 'em', '%' ),
1835 'selectors' => array(
1836 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'border-radius: {{SIZE}}{{UNIT}};',
1837 ),
1838 )
1839 );
1840
1841 $this->add_group_control(
1842 Group_Control_Box_Shadow::get_type(),
1843 array(
1844 'label' => __( 'Shadow', 'premium-addons-for-elementor' ),
1845 'name' => 'premium_gallery_icons_style_shadow_hover',
1846 'selector' => '{{WRAPPER}} {{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span',
1847 )
1848 );
1849
1850 $this->add_responsive_control(
1851 'premium_gallery_icons_style_margin_hover',
1852 array(
1853 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1854 'type' => Controls_Manager::DIMENSIONS,
1855 'size_units' => array( 'px', 'em', '%' ),
1856 'selectors' => array(
1857 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1858 ),
1859 )
1860 );
1861
1862 $this->add_responsive_control(
1863 'premium_gallery_icons_style_padding_hover',
1864 array(
1865 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1866 'type' => Controls_Manager::DIMENSIONS,
1867 'size_units' => array( 'px', 'em', '%' ),
1868 'selectors' => array(
1869 '{{WRAPPER}} .pa-gallery-magnific-image:hover span, {{WRAPPER}} .pa-gallery-img-link:hover span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1870 ),
1871 )
1872 );
1873
1874 $this->end_controls_tab();
1875
1876 $this->end_controls_tabs();
1877
1878 $this->end_controls_section();
1879
1880 $this->start_controls_section(
1881 'premium_gallery_filter_style',
1882 array(
1883 'label' => __( 'Filter Tabs', 'premium-addons-for-elementor' ),
1884 'tab' => Controls_Manager::TAB_STYLE,
1885 'condition' => array(
1886 'premium_gallery_filter' => 'yes',
1887 ),
1888 )
1889 );
1890
1891 $this->add_group_control(
1892 Group_Control_Typography::get_type(),
1893 array(
1894 'name' => 'premium_gallery_filter_typo',
1895 'global' => array(
1896 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
1897 ),
1898 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category',
1899 )
1900 );
1901
1902 $this->start_controls_tabs( 'premium_gallery_filters' );
1903
1904 $this->start_controls_tab(
1905 'premium_gallery_filters_normal',
1906 array(
1907 'label' => __( 'Normal', 'premium-addons-for-elementor' ),
1908 )
1909 );
1910
1911 $this->add_control(
1912 'premium_gallery_filter_color',
1913 array(
1914 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
1915 'type' => Controls_Manager::COLOR,
1916 'global' => array(
1917 'default' => Global_Colors::COLOR_SECONDARY,
1918 ),
1919 'selectors' => array(
1920 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'color: {{VALUE}};',
1921 ),
1922 )
1923 );
1924
1925 $this->add_control(
1926 'premium_gallery_background_color',
1927 array(
1928 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1929 'type' => Controls_Manager::COLOR,
1930 'selectors' => array(
1931 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'background-color: {{VALUE}};',
1932 ),
1933 )
1934 );
1935
1936 $this->add_control(
1937 'filter_lq_effect',
1938 array(
1939 'label' => __( 'Liquid Glass Effect', 'premium-addons-for-elementor' ),
1940 'type' => Controls_Manager::SELECT,
1941 'description' => sprintf(
1942 /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */
1943 esc_html__( 'Important: Make sure this element has a semi-transparent background color to see the effect. See all presets from %1$shere%2$s.', 'premium-addons-for-elementor' ),
1944 '<a href="https://premiumaddons.com/liquid-glass/" target="_blank">',
1945 '</a>'
1946 ),
1947 'options' => array(
1948 'none' => __( 'None', 'premium-addons-for-elementor' ),
1949 'glass1' => __( 'Preset 01', 'premium-addons-for-elementor' ),
1950 'glass2' => __( 'Preset 02', 'premium-addons-for-elementor' ),
1951 'glass3' => apply_filters( 'pa_pro_label', __( 'Preset 03 (Pro)', 'premium-addons-for-elementor' ) ),
1952 'glass4' => apply_filters( 'pa_pro_label', __( 'Preset 04 (Pro)', 'premium-addons-for-elementor' ) ),
1953 'glass5' => apply_filters( 'pa_pro_label', __( 'Preset 05 (Pro)', 'premium-addons-for-elementor' ) ),
1954 'glass6' => apply_filters( 'pa_pro_label', __( 'Preset 06 (Pro)', 'premium-addons-for-elementor' ) ),
1955 ),
1956 'default' => 'none',
1957 'label_block' => true,
1958 )
1959 );
1960
1961 $this->add_group_control(
1962 Group_Control_Border::get_type(),
1963 array(
1964 'name' => 'premium_gallery_filter_border',
1965 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category',
1966 )
1967 );
1968
1969 $this->add_control(
1970 'premium_gallery_filter_border_radius',
1971 array(
1972 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1973 'type' => Controls_Manager::SLIDER,
1974 'size_units' => array( 'px', 'em', '%' ),
1975 'selectors' => array(
1976 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'border-radius: {{SIZE}}{{UNIT}};',
1977 ),
1978 'condition' => array(
1979 'filter_adv_radius!' => 'yes',
1980 ),
1981 )
1982 );
1983
1984 $this->add_control(
1985 'filter_adv_radius',
1986 array(
1987 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
1988 'type' => Controls_Manager::SWITCHER,
1989 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>',
1990 )
1991 );
1992
1993 $this->add_control(
1994 'filter_adv_radius_value',
1995 array(
1996 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1997 'type' => Controls_Manager::TEXT,
1998 'dynamic' => array( 'active' => true ),
1999 'selectors' => array(
2000 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'border-radius: {{VALUE}};',
2001 ),
2002 'condition' => array(
2003 'filter_adv_radius' => 'yes',
2004 ),
2005 'ai' => array(
2006 'active' => false,
2007 ),
2008 )
2009 );
2010
2011 $this->end_controls_tab();
2012
2013 $this->start_controls_tab(
2014 'premium_gallery_filters_hover',
2015 array(
2016 'label' => __( 'Hover', 'premium-addons-for-elementor' ),
2017 )
2018 );
2019
2020 $this->add_control(
2021 'premium_gallery_filter_hover_color',
2022 array(
2023 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
2024 'type' => Controls_Manager::COLOR,
2025 'selectors' => array(
2026 '{{WRAPPER}} .premium-gallery-cats-container li a:hover' => 'color: {{VALUE}};',
2027 ),
2028 )
2029 );
2030
2031 $this->add_control(
2032 'premium_gallery_background_hover_color',
2033 array(
2034 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
2035 'type' => Controls_Manager::COLOR,
2036 'selectors' => array(
2037 '{{WRAPPER}} .premium-gallery-cats-container li a:hover' => 'background-color: {{VALUE}};',
2038 ),
2039 )
2040 );
2041
2042 $this->add_group_control(
2043 Group_Control_Border::get_type(),
2044 array(
2045 'name' => 'premium_gallery_filter_border_hover',
2046 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category:hover',
2047 )
2048 );
2049
2050 $this->add_control(
2051 'premium_gallery_filter_border_radius_hover',
2052 array(
2053 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2054 'type' => Controls_Manager::SLIDER,
2055 'size_units' => array( 'px', 'em', '%' ),
2056 'selectors' => array(
2057 '{{WRAPPER}} .premium-gallery-cats-container li a.category:hover' => 'border-radius: {{SIZE}}{{UNIT}};',
2058 ),
2059 'condition' => array(
2060 'filter_hover_adv_radius!' => 'yes',
2061 ),
2062 )
2063 );
2064
2065 $this->add_control(
2066 'filter_hover_adv_radius',
2067 array(
2068 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
2069 'type' => Controls_Manager::SWITCHER,
2070 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>',
2071 )
2072 );
2073
2074 $this->add_control(
2075 'filter_hover_adv_radius_value',
2076 array(
2077 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2078 'type' => Controls_Manager::TEXT,
2079 'dynamic' => array( 'active' => true ),
2080 'selectors' => array(
2081 '{{WRAPPER}} .premium-gallery-cats-container li a.category:hover' => 'border-radius: {{VALUE}};',
2082 ),
2083 'condition' => array(
2084 'filter_hover_adv_radius' => 'yes',
2085 ),
2086 'ai' => array(
2087 'active' => false,
2088 ),
2089 )
2090 );
2091
2092 $this->end_controls_tab();
2093
2094 $this->start_controls_tab(
2095 'premium_gallery_filters_active',
2096 array(
2097 'label' => __( 'Active', 'premium-addons-for-elementor' ),
2098 )
2099 );
2100
2101 $this->add_control(
2102 'premium_gallery_filter_active_color',
2103 array(
2104 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
2105 'type' => Controls_Manager::COLOR,
2106 'global' => array(
2107 'default' => Global_Colors::COLOR_PRIMARY,
2108 ),
2109 'selectors' => array(
2110 '{{WRAPPER}} .premium-gallery-cats-container li a.active' => 'color: {{VALUE}};',
2111 ),
2112 )
2113 );
2114
2115 $this->add_control(
2116 'premium_gallery_background_active_color',
2117 array(
2118 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
2119 'type' => Controls_Manager::COLOR,
2120 'selectors' => array(
2121 '{{WRAPPER}} .premium-gallery-cats-container li a.active' => 'background-color: {{VALUE}};',
2122 ),
2123 )
2124 );
2125
2126 $this->add_group_control(
2127 Group_Control_Border::get_type(),
2128 array(
2129 'name' => 'premium_gallery_filter_border_active',
2130 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.active',
2131 )
2132 );
2133
2134 $this->add_control(
2135 'premium_gallery_filter_border_radius_active',
2136 array(
2137 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2138 'type' => Controls_Manager::SLIDER,
2139 'size_units' => array( 'px', 'em', '%' ),
2140 'selectors' => array(
2141 '{{WRAPPER}} .premium-gallery-cats-container li a.active' => 'border-radius: {{SIZE}}{{UNIT}};',
2142 ),
2143 'condition' => array(
2144 'filter_active_adv_radius!' => 'yes',
2145 ),
2146 )
2147 );
2148
2149 $this->add_control(
2150 'filter_active_adv_radius',
2151 array(
2152 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
2153 'type' => Controls_Manager::SWITCHER,
2154 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>',
2155 )
2156 );
2157
2158 $this->add_control(
2159 'filter_active_adv_radius_value',
2160 array(
2161 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2162 'type' => Controls_Manager::TEXT,
2163 'dynamic' => array( 'active' => true ),
2164 'selectors' => array(
2165 '{{WRAPPER}} .premium-gallery-cats-container li a.active' => 'border-radius: {{VALUE}};',
2166 ),
2167 'condition' => array(
2168 'filter_active_adv_radius' => 'yes',
2169 ),
2170 'ai' => array(
2171 'active' => false,
2172 ),
2173 )
2174 );
2175
2176 $this->end_controls_tab();
2177
2178 $this->end_controls_tabs();
2179
2180 $this->add_group_control(
2181 Group_Control_Box_Shadow::get_type(),
2182 array(
2183 'name' => 'premium_gallery_filter_shadow',
2184 'selector' => '{{WRAPPER}} .premium-gallery-cats-container li a.category',
2185 )
2186 );
2187
2188 $this->add_responsive_control(
2189 'premium_gallery_filter_margin',
2190 array(
2191 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2192 'type' => Controls_Manager::DIMENSIONS,
2193 'size_units' => array( 'px', 'em', '%' ),
2194 'selectors' => array(
2195 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2196 ),
2197 )
2198 );
2199
2200 $this->add_responsive_control(
2201 'premium_gallery_filter_padding',
2202 array(
2203 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2204 'type' => Controls_Manager::DIMENSIONS,
2205 'size_units' => array( 'px', 'em', '%' ),
2206 'selectors' => array(
2207 '{{WRAPPER}} .premium-gallery-cats-container li a.category' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2208 ),
2209 )
2210 );
2211
2212 $this->end_controls_section();
2213
2214 $this->start_controls_section(
2215 'premium_gallery_button_style_settings',
2216 array(
2217 'label' => __( 'Load More Button', 'premium-addons-for-elementor' ),
2218 'tab' => Controls_Manager::TAB_STYLE,
2219 'condition' => array(
2220 'premium_gallery_load_more' => 'yes',
2221 ),
2222 )
2223 );
2224
2225 $this->add_group_control(
2226 Group_Control_Typography::get_type(),
2227 array(
2228 'name' => 'premium_gallery_button_typo',
2229 'global' => array(
2230 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
2231 ),
2232 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
2233 )
2234 );
2235
2236 $this->start_controls_tabs( 'premium_gallery_button_style_tabs' );
2237
2238 $this->start_controls_tab(
2239 'premium_gallery_button_style_normal',
2240 array(
2241 'label' => __( 'Normal', 'premium-addons-for-elementor' ),
2242 )
2243 );
2244
2245 $this->add_control(
2246 'premium_gallery_button_color',
2247 array(
2248 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
2249 'type' => Controls_Manager::COLOR,
2250 'global' => array(
2251 'default' => Global_Colors::COLOR_SECONDARY,
2252 ),
2253 'selectors' => array(
2254 '{{WRAPPER}} .premium-gallery-load-more-btn' => 'color: {{VALUE}};',
2255 '{{WRAPPER}} .premium-gallery-load-more-btn .premium-loader' => 'border-color: {{VALUE}};',
2256 ),
2257 )
2258 );
2259
2260 $this->add_control(
2261 'premium_gallery_button_spin_color',
2262 array(
2263 'label' => __( 'Spinner Color', 'premium-addons-for-elementor' ),
2264 'type' => Controls_Manager::COLOR,
2265 'global' => array(
2266 'default' => Global_Colors::COLOR_SECONDARY,
2267 ),
2268 'selectors' => array(
2269 '{{WRAPPER}} .premium-gallery-load-more-btn .premium-loader' => 'border-top-color: {{VALUE}};',
2270 ),
2271 )
2272 );
2273
2274 $this->add_group_control(
2275 Group_Control_Text_Shadow::get_type(),
2276 array(
2277 'name' => 'premium_gallery_button_text_shadow',
2278 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
2279 )
2280 );
2281
2282 $this->add_group_control(
2283 Premium_Background::get_type(),
2284 array(
2285 'name' => 'premium_gallery_button_background',
2286 'types' => array( 'classic', 'gradient' ),
2287 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
2288 )
2289 );
2290
2291 $this->add_group_control(
2292 Group_Control_Border::get_type(),
2293 array(
2294 'name' => 'premium_gallery_button_border',
2295 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
2296 )
2297 );
2298
2299 $this->add_control(
2300 'premium_gallery_button_border_radius',
2301 array(
2302 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2303 'type' => Controls_Manager::SLIDER,
2304 'size_units' => array( 'px', 'em', '%' ),
2305 'selectors' => array(
2306 '{{WRAPPER}} .premium-gallery-load-more-btn' => 'border-radius: {{SIZE}}{{UNIT}};',
2307 ),
2308 )
2309 );
2310
2311 $this->add_group_control(
2312 Group_Control_Box_Shadow::get_type(),
2313 array(
2314 'name' => 'premium_gallery_button_box_shadow',
2315 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn',
2316 )
2317 );
2318
2319 $this->add_responsive_control(
2320 'premium_gallery_button_margin',
2321 array(
2322 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2323 'type' => Controls_Manager::DIMENSIONS,
2324 'size_units' => array( 'px', 'em', '%' ),
2325 'selectors' => array(
2326 '{{WRAPPER}} .premium-gallery-load-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2327 ),
2328 )
2329 );
2330
2331 $this->add_responsive_control(
2332 'premium_gallery_button_padding',
2333 array(
2334 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2335 'type' => Controls_Manager::DIMENSIONS,
2336 'size_units' => array( 'px', 'em', '%' ),
2337 'selectors' => array(
2338 '{{WRAPPER}} .premium-gallery-load-more-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2339 ),
2340 )
2341 );
2342
2343 $this->end_controls_tab();
2344
2345 $this->start_controls_tab(
2346 'premium_gallery_button_style_hover',
2347 array(
2348 'label' => __( 'Hover', 'premium-addons-for-elementor' ),
2349 )
2350 );
2351
2352 $this->add_control(
2353 'premium_gallery_button_hover_color',
2354 array(
2355 'label' => __( 'Text Hover Color', 'premium-addons-for-elementor' ),
2356 'type' => Controls_Manager::COLOR,
2357 'global' => array(
2358 'default' => Global_Colors::COLOR_SECONDARY,
2359 ),
2360 'selectors' => array(
2361 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'color: {{VALUE}};',
2362 ),
2363 )
2364 );
2365
2366 $this->add_group_control(
2367 Group_Control_Text_Shadow::get_type(),
2368 array(
2369 'name' => 'premium_gallery_button_text_shadow_hover',
2370 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
2371 )
2372 );
2373
2374 $this->add_group_control(
2375 Premium_Background::get_type(),
2376 array(
2377 'name' => 'premium_gallery_button_background_hover',
2378 'types' => array( 'classic', 'gradient' ),
2379 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
2380 )
2381 );
2382
2383 $this->add_group_control(
2384 Group_Control_Border::get_type(),
2385 array(
2386 'name' => 'premium_gallery_button_border_hover',
2387 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
2388 )
2389 );
2390
2391 $this->add_control(
2392 'button_border_radius_hover',
2393 array(
2394 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2395 'type' => Controls_Manager::SLIDER,
2396 'size_units' => array( 'px', 'em', '%' ),
2397 'selectors' => array(
2398 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'border-radius: {{SIZE}}{{UNIT}};',
2399 ),
2400 )
2401 );
2402
2403 $this->add_group_control(
2404 Group_Control_Box_Shadow::get_type(),
2405 array(
2406 'name' => 'premium_gallery_button_shadow_hover',
2407 'selector' => '{{WRAPPER}} .premium-gallery-load-more-btn:hover',
2408 )
2409 );
2410
2411 $this->add_responsive_control(
2412 'button_margin_hover',
2413 array(
2414 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2415 'type' => Controls_Manager::DIMENSIONS,
2416 'size_units' => array( 'px', 'em', '%' ),
2417 'selectors' => array(
2418 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2419 ),
2420 )
2421 );
2422
2423 $this->add_responsive_control(
2424 'premium_gallery_button_padding_hover',
2425 array(
2426 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2427 'type' => Controls_Manager::DIMENSIONS,
2428 'size_units' => array( 'px', 'em', '%' ),
2429 'selectors' => array(
2430 '{{WRAPPER}} .premium-gallery-load-more-btn:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2431 ),
2432 )
2433 );
2434
2435 $this->end_controls_tab();
2436
2437 $this->end_controls_tabs();
2438
2439 $this->end_controls_section();
2440
2441 $this->start_controls_section(
2442 'section_lightbox_style',
2443 array(
2444 'label' => __( 'Lightbox', 'premium-addons-for-elementor' ),
2445 'tab' => Controls_Manager::TAB_STYLE,
2446 'condition' => array(
2447 'premium_gallery_lightbox_type' => 'yes',
2448 ),
2449 )
2450 );
2451
2452 $this->add_control(
2453 'lightbox_color',
2454 array(
2455 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
2456 'type' => Controls_Manager::COLOR,
2457 'selectors' => array(
2458 '#elementor-lightbox-slideshow-{{ID}}, #elementor-lightbox-{{ID}}' => 'background-color: {{VALUE}};',
2459 ),
2460 )
2461 );
2462
2463 $this->add_control(
2464 'lightbox_ui_color',
2465 array(
2466 'label' => __( 'UI Color', 'premium-addons-for-elementor' ),
2467 'type' => Controls_Manager::COLOR,
2468 'selectors' => array(
2469 '#elementor-lightbox-slideshow-{{ID}} .dialog-lightbox-close-button, #elementor-lightbox-{{ID}} .dialog-lightbox-close-button' => 'color: {{VALUE}};',
2470 '#elementor-lightbox-slideshow-{{ID}} svg, #elementor-lightbox-{{ID}} svg' => 'fill: {{VALUE}}',
2471 ),
2472 )
2473 );
2474
2475 $this->add_control(
2476 'lightbox_ui_hover_color',
2477 array(
2478 'label' => __( 'UI Hover Color', 'premium-addons-for-elementor' ),
2479 'type' => Controls_Manager::COLOR,
2480 'selectors' => array(
2481 '#elementor-lightbox-slideshow-{{ID}} .dialog-lightbox-close-button:hover, #elementor-lightbox-{{ID}} .dialog-lightbox-close-button:hover' => 'color: {{VALUE}};',
2482 '#elementor-lightbox-slideshow-{{ID}} svg:hover, #elementor-lightbox-{{ID}} svg:hover' => 'fill: {{VALUE}}',
2483 ),
2484 )
2485 );
2486
2487 $this->end_controls_section();
2488
2489 $this->start_controls_section(
2490 'premium_gallery_general_style',
2491 array(
2492 'label' => __( 'Grid Container', 'premium-addons-for-elementor' ),
2493 'tab' => Controls_Manager::TAB_STYLE,
2494 )
2495 );
2496
2497 $this->add_group_control(
2498 Premium_Background::get_type(),
2499 array(
2500 'name' => 'premium_gallery_general_background',
2501 'types' => array( 'classic', 'gradient' ),
2502 'selector' => '{{WRAPPER}} .premium-img-gallery',
2503 )
2504 );
2505
2506 $this->add_group_control(
2507 Group_Control_Border::get_type(),
2508 array(
2509 'name' => 'premium_gallery_general_border',
2510 'selector' => '{{WRAPPER}} .premium-img-gallery',
2511 )
2512 );
2513
2514 $this->add_control(
2515 'premium_gallery_general_border_radius',
2516 array(
2517 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2518 'type' => Controls_Manager::SLIDER,
2519 'size_units' => array( 'px', '%', 'em' ),
2520 'selectors' => array(
2521 '{{WRAPPER}} .premium-img-gallery' => 'border-radius: {{SIZE}}{{UNIT}};',
2522 ),
2523 )
2524 );
2525
2526 $this->add_group_control(
2527 Group_Control_Box_Shadow::get_type(),
2528 array(
2529 'name' => 'premium_gallery_general_box_shadow',
2530 'selector' => '{{WRAPPER}} .premium-img-gallery',
2531 )
2532 );
2533
2534 $this->add_responsive_control(
2535 'premium_gallery_general_margin',
2536 array(
2537 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2538 'type' => Controls_Manager::DIMENSIONS,
2539 'size_units' => array( 'px', 'em', '%' ),
2540 'selectors' => array(
2541 '{{WRAPPER}} .premium-img-gallery' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
2542 ),
2543 )
2544 );
2545
2546 $this->add_responsive_control(
2547 'premium_gallery_general_padding',
2548 array(
2549 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2550 'type' => Controls_Manager::DIMENSIONS,
2551 'size_units' => array( 'px', 'em', '%' ),
2552 'selectors' => array(
2553 '{{WRAPPER}} .premium-img-gallery' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
2554 ),
2555 )
2556 );
2557
2558 $this->end_controls_section();
2559 }
2560
2561 /**
2562 * Filter Cats
2563 *
2564 * Formats Category to be inserted in class attribute.
2565 *
2566 * @since 2.1.0
2567 * @access public
2568 *
2569 * @param string $string category slug.
2570 *
2571 * @return string $cat_filtered slug filtered.
2572 */
2573 public function filter_cats( $string ) {
2574
2575 $cat_filtered = trim( $string );
2576
2577 $cat_filtered = extension_loaded( 'mbstring' ) ? mb_strtolower( $cat_filtered ) : strtolower( $cat_filtered );
2578
2579 if ( strpos( $cat_filtered, 'class' ) || strpos( $cat_filtered, 'src' ) ) {
2580 $cat_filtered = substr( $cat_filtered, strpos( $cat_filtered, '"' ) + 1 );
2581 $cat_filtered = strtok( $cat_filtered, '"' );
2582 $cat_filtered = preg_replace( '/[http:.]/', '', $cat_filtered );
2583 $cat_filtered = str_replace( '/', '', $cat_filtered );
2584 }
2585
2586 $cat_filtered = str_replace( ', ', ',', $cat_filtered );
2587 $cat_filtered = preg_replace( '/[\s_`\'&@!#%]/', '-', $cat_filtered );
2588 $cat_filtered = str_replace( ',', ' ', $cat_filtered );
2589
2590 return $cat_filtered;
2591 }
2592
2593 /**
2594 * Render Filter Tabs on the frontend
2595 *
2596 * @since 2.1.0
2597 * @access protected
2598 *
2599 * @param string $first Class for the first category.
2600 * @param integer $active_index active category index.
2601 */
2602 protected function render_filter_tabs( $first, $active_index ) {
2603
2604 $settings = $this->get_settings_for_display();
2605
2606 if ( 'none' !== $settings['filter_lq_effect'] ) {
2607 $first .= ' premium-con-lq__' . $settings['filter_lq_effect'];
2608 }
2609
2610 ?>
2611
2612 <div class="premium-img-gallery-filter">
2613 <ul class="premium-gallery-cats-container">
2614 <?php if ( 'yes' === $settings['premium_gallery_first_cat_switcher'] ) : ?>
2615 <li>
2616 <a href="javascript:;" class="category <?php echo esc_attr( $first ); ?>" data-filter="*">
2617 <?php echo wp_kses_post( $settings['premium_gallery_first_cat_label'] ); ?>
2618 </a>
2619 </li>
2620 <?php
2621 endif;
2622 foreach ( $settings['premium_gallery_cats_content'] as $index => $category ) {
2623 if ( ! empty( $category['premium_gallery_img_cat'] ) ) {
2624 $cat_filtered = $this->filter_cats( $category['premium_gallery_img_cat'] );
2625
2626 $key = 'premium_grid_category_' . $index;
2627
2628 if ( $active_index === $index ) {
2629 $this->add_render_attribute( $key, 'class', 'active' );
2630 }
2631
2632 $this->add_render_attribute(
2633 $key,
2634 'class',
2635 array(
2636 'category',
2637 'elementor-repeater-item-' . $category['_id'],
2638 'none' !== $settings['filter_lq_effect'] ? 'premium-con-lq__' . $settings['filter_lq_effect'] : '',
2639 )
2640 );
2641
2642 $slug = sprintf( '.%s', $cat_filtered );
2643
2644 $this->add_render_attribute( $key, 'data-filter', $slug );
2645 ?>
2646 <li>
2647 <a href="javascript:;" <?php $this->print_render_attribute_string( $key ); ?>>
2648 <?php echo wp_kses_post( $category['premium_gallery_img_cat'] ); ?>
2649 </a>
2650 </li>
2651 <?php
2652 }
2653 }
2654 ?>
2655 </ul>
2656 </div>
2657
2658 <?php
2659 }
2660
2661 /**
2662 * Render Grid output on the frontend.
2663 *
2664 * Written in PHP and used to generate the final HTML.
2665 *
2666 * @since 2.1.0
2667 * @access protected
2668 */
2669 protected function render() {
2670
2671 $settings = $this->get_settings_for_display();
2672
2673 $filter = $settings['premium_gallery_filter'];
2674
2675 $skin = $settings['premium_gallery_img_style'];
2676
2677 $layout = $settings['premium_gallery_img_size_select'];
2678
2679 $lightbox = $settings['premium_gallery_light_box'];
2680
2681 $lightbox_type = $settings['premium_gallery_lightbox_type'];
2682
2683 $show_play = $settings['premium_gallery_video_icon'];
2684
2685 if ( 'yes' === $settings['premium_gallery_responsive_switcher'] ) {
2686 $min_size = $settings['premium_gallery_min_range'] . 'px';
2687 $max_size = $settings['premium_gallery_max_range'] . 'px';
2688 }
2689
2690 $category = '*';
2691
2692 if ( 'yes' === $filter ) {
2693
2694 if ( ! empty( $settings['premium_gallery_active_cat'] ) || 0 === $settings['premium_gallery_active_cat'] ) {
2695
2696 if ( 'yes' !== $settings['premium_gallery_first_cat_switcher'] ) {
2697 $active_index = $settings['premium_gallery_active_cat'];
2698 $active_category = $settings['premium_gallery_cats_content'][ $active_index ]['premium_gallery_img_cat'];
2699 $category = '.' . $this->filter_cats( $active_category );
2700 $active_cat_index = $settings['premium_gallery_active_cat'];
2701
2702 } else {
2703 $active_cat_index = $settings['premium_gallery_active_cat'] - 1;
2704 }
2705 } else {
2706 $active_cat_index = 'yes' === $settings['premium_gallery_first_cat_switcher'] ? -1 : 0;
2707 }
2708
2709 $is_all_active = ( 0 > $active_cat_index ) ? 'active' : '';
2710
2711 }
2712
2713 if ( 'original' === $layout ) {
2714 $layout = 'masonry';
2715 } elseif ( 'one_size' === $layout ) {
2716 $layout = 'fitRows';
2717 }
2718
2719 $ltr_mode = 'yes' === $settings['premium_gallery_rtl_mode'] ? false : true;
2720
2721 $shuffle = 'yes' === $settings['premium_gallery_shuffle'] ? true : false;
2722
2723 $shuffle_onload = 'yes' === $settings['premium_gallery_shuffle_onload'] ? 'random' : 'original-order';
2724
2725 $grid_settings = array(
2726 'img_size' => $layout,
2727 'filter' => $filter,
2728 'theme' => $settings['premium_gallery_lightbox_theme'],
2729 'active_cat' => $category,
2730 'ltr_mode' => $ltr_mode,
2731 'shuffle' => $shuffle,
2732 'sort_by' => $shuffle_onload,
2733 'skin' => $skin,
2734 );
2735
2736 if ( 'yes' === $filter ) {
2737 $grid_settings['flag'] = ! empty( $settings['url_flag'] ) ? $settings['url_flag'] : 'cat';
2738 }
2739
2740 $load_more = 'yes' === $settings['premium_gallery_load_more'] ? true : false;
2741
2742 if ( $load_more ) {
2743 $minimum = ! empty( $settings['premium_gallery_load_minimum'] ) ? $settings['premium_gallery_load_minimum'] : 6;
2744 $click_number = ! empty( $settings['premium_gallery_load_click_number'] ) ? $settings['premium_gallery_load_click_number'] : 6;
2745
2746 $grid_settings = array_merge(
2747 $grid_settings,
2748 array(
2749 'load_more' => $load_more,
2750 'minimum' => $minimum,
2751 'click_images' => $click_number,
2752 )
2753 );
2754 }
2755
2756 if ( 'yes' === $lightbox ) {
2757 $grid_settings = array_merge(
2758 $grid_settings,
2759 array(
2760 'light_box' => $lightbox,
2761 'lightbox_type' => $lightbox_type,
2762 'overlay' => 'yes' === $settings['premium_gallery_overlay_gallery'] ? true : false,
2763 )
2764 );
2765 } else {
2766 $this->add_render_attribute(
2767 'grid',
2768 array(
2769 'class' => array(
2770 'premium-img-gallery-no-lightbox',
2771 ),
2772 )
2773 );
2774 }
2775
2776 $this->add_render_attribute(
2777 'grid',
2778 array(
2779 'id' => 'premium-img-gallery-' . esc_attr( $this->get_id() ),
2780 'class' => array(
2781 'elementor-invisible',
2782 'premium-img-gallery',
2783 'premium-img-gallery-' . $layout,
2784 $settings['premium_gallery_img_effect'],
2785 ),
2786 )
2787 );
2788
2789 if ( $show_play ) {
2790 $this->add_render_attribute(
2791 'grid',
2792 array(
2793 'class' => array(
2794 'premium-gallery-icon-show',
2795 ),
2796 )
2797 );
2798 }
2799
2800 $this->add_render_attribute(
2801 'gallery_container',
2802 array(
2803 'class' => 'premium-gallery-container',
2804 'data-settings' => wp_json_encode( $grid_settings ),
2805 )
2806 );
2807
2808 $this->add_render_attribute(
2809 'image_container',
2810 'class',
2811 array(
2812 'pa-gallery-img-container',
2813 )
2814 );
2815
2816 ?>
2817
2818 <div <?php $this->print_render_attribute_string( 'grid' ); ?>>
2819 <?php
2820 if ( 'yes' === $filter ) :
2821 $this->render_filter_tabs( $is_all_active, $active_cat_index );
2822 endif;
2823 ?>
2824
2825 <div <?php $this->print_render_attribute_string( 'gallery_container' ); ?>>
2826
2827 <?php if ( 'metro' === $layout ) : ?>
2828 <div class="grid-sizer"></div>
2829 <?php
2830 endif;
2831
2832 foreach ( $settings['premium_gallery_img_content'] as $index => $image ) :
2833
2834 $key = 'gallery_item_' . $index;
2835
2836 $image_id = apply_filters( 'wpml_object_id', $image['premium_gallery_img']['id'], 'attachment', true );
2837
2838 // Check for Image ID, but not for the default Elementor placeholder.
2839 // if ( false === strpos( $image['premium_gallery_img']['url'], 'placeholder.png' ) && ! $image['premium_gallery_video'] && ! $image_id && empty( $image['premium_gallery_img']['url'] ) ) {
2840 // continue;
2841 // }
2842
2843 $image_by_id = get_post( $image_id );
2844
2845 $alt = $image_by_id ? $this->get_lightbox_title( $image_by_id ) : '';
2846
2847 $this->add_render_attribute(
2848 $key,
2849 array(
2850 'class' => array(
2851 'premium-gallery-item',
2852 'elementor-repeater-item-' . $image['_id'],
2853 $this->filter_cats( $image['premium_gallery_img_category'] ),
2854 ),
2855 )
2856 );
2857
2858 if ( $load_more && $index > $minimum - 1 ) {
2859
2860 $this->add_render_attribute( $key, 'class', 'premium-gallery-item-hidden' );
2861
2862 }
2863
2864 if ( $image['premium_gallery_video'] ) {
2865 $this->add_render_attribute( $key, 'class', 'premium-gallery-video-item' );
2866 }
2867 ?>
2868 <div <?php $this->print_render_attribute_string( $key ); ?>>
2869 <div class="pa-gallery-img <?php echo esc_attr( $skin ); ?>" onclick="">
2870 <div <?php $this->print_render_attribute_string( 'image_container' ); ?>>
2871 <?php
2872 $video_data = $this->render_grid_item( $image, $index );
2873
2874 $image['video_link'] = $video_data['link'];
2875 $image['video_thumb'] = $video_data['thumbnail'];
2876 if ( 'style3' === $skin ) :
2877 ?>
2878 <div class="pa-gallery-icons-wrapper">
2879 <div class="pa-gallery-icons-inner-container">
2880 <?php $this->render_icons( $image, $index, $alt ); ?>
2881 </div>
2882 </div>
2883 <?php endif; ?>
2884 </div>
2885 <?php
2886 if ( 'style2' !== $skin ) :
2887 if ( 'default' === $skin || 'style1' === $skin ) :
2888 ?>
2889 <div class="pa-gallery-icons-wrapper">
2890 <div class="pa-gallery-icons-inner-container">
2891 <?php $this->render_icons( $image, $index, $alt ); ?>
2892 </div>
2893 </div>
2894 <?php
2895 endif;
2896 $this->render_image_caption( $image );
2897 else :
2898 ?>
2899 <div class="pa-gallery-icons-caption-container">
2900 <div class="pa-gallery-icons-caption-cell">
2901 <?php
2902 $this->render_icons( $image, $index, $alt );
2903 $this->render_image_caption( $image );
2904 ?>
2905 </div>
2906 </div>
2907 <?php
2908 endif;
2909 if ( $image['premium_gallery_video'] ) :
2910 ?>
2911 </div>
2912 </div>
2913 <?php
2914 continue;
2915 endif;
2916 if ( 'yes' === $image['premium_gallery_link_whole'] ) {
2917
2918 $link_key = 'image_link_' . $index;
2919
2920 $this->add_render_attribute(
2921 $link_key,
2922 array(
2923 'class' => 'pa-gallery-whole-link',
2924 )
2925 );
2926
2927 if ( 'url' === $image['premium_gallery_img_link_type'] ) {
2928 $icon_link = $image['premium_gallery_img_link'];
2929 } else {
2930 $icon_link = get_permalink( $image['premium_gallery_img_existing'] );
2931 }
2932
2933 if ( ! empty( $icon_link ) ) {
2934
2935 if ( 'url' === $image['premium_gallery_img_link_type'] ) {
2936 $this->add_link_attributes( $link_key, $icon_link );
2937
2938 } else {
2939 $this->add_render_attribute( $link_key, 'href', $icon_link );
2940 }
2941
2942 ?>
2943 <a <?php $this->print_render_attribute_string( $link_key ); ?>>
2944 <span>
2945 <?php echo wp_kses_post( $image['premium_gallery_img_name'] ); ?>
2946 </span>
2947 </a>
2948 <?php
2949 }
2950 } elseif ( 'yes' === $lightbox ) {
2951
2952 if ( 'yes' === $image['premium_gallery_lightbox_whole'] ) {
2953
2954 $lightbox_key = 'image_lightbox_' . $index;
2955
2956 $this->add_render_attribute(
2957 $lightbox_key,
2958 array(
2959 'class' => 'pa-gallery-whole-link',
2960 'href' => esc_url( $image['premium_gallery_img']['url'] ),
2961 )
2962 );
2963
2964 if ( 'default' !== $lightbox_type ) {
2965
2966 $this->add_render_attribute(
2967 $lightbox_key,
2968 array(
2969 'data-elementor-open-lightbox' => $lightbox_type,
2970 'data-elementor-lightbox-slideshow' => count( $settings['premium_gallery_img_content'] ) > 1 ? $this->get_id() : false,
2971 )
2972 );
2973
2974 if ( 'yes' === $settings['lightbox_show_title'] ) {
2975
2976 $this->add_render_attribute( $lightbox_key, 'data-elementor-lightbox-title', $alt );
2977
2978 }
2979 } else {
2980
2981 $rel = sprintf( 'prettyPhoto[premium-grid-%s]', $this->get_id() );
2982
2983 $this->add_render_attribute(
2984 $lightbox_key,
2985 array(
2986 'data-rel' => $rel,
2987 )
2988 );
2989 }
2990
2991 ?>
2992
2993 <a <?php $this->print_render_attribute_string( $lightbox_key ); ?>></a>
2994
2995 <?php
2996 }
2997 }
2998 ?>
2999 </div>
3000 </div>
3001 <?php endforeach; ?>
3002
3003 <?php if ( 'yes' === $settings['gradient_layer'] ) : ?>
3004 <div class="premium-gallery-gradient-layer"></div>
3005 <?php endif; ?>
3006 </div>
3007
3008 <?php if ( 'yes' === $settings['premium_gallery_load_more'] ) : ?>
3009 <div class="premium-gallery-load-more premium-gallery-btn-hidden">
3010 <button class="premium-gallery-load-more-btn">
3011 <?php echo wp_kses_post( $settings['premium_gallery_load_more_text'] ); ?>
3012 <div class="premium-loader"></div>
3013 </button>
3014 </div>
3015 <?php endif; ?>
3016
3017 </div>
3018
3019 <?php
3020 if ( \Elementor\Plugin::instance()->editor->is_edit_mode() ) {
3021
3022 if ( 'metro' !== $settings['premium_gallery_img_size_select'] ) {
3023 $this->render_editor_script();
3024 }
3025 }
3026 ?>
3027
3028 <?php if ( 'yes' === $settings['premium_gallery_responsive_switcher'] ) : ?>
3029 <style>
3030 @media( min-width: <?php echo esc_attr( $min_size ); ?> ) and ( max-width:<?php echo esc_attr( $max_size ); ?> ) {
3031 #premium-img-gallery-<?php echo esc_attr( $this->get_id() ); ?> .premium-gallery-caption {
3032 display: none;
3033 }
3034 }
3035 </style>
3036 <?php endif; ?>
3037
3038 <?php
3039 }
3040
3041 /**
3042 * Gets lightbox Title according to the Global Lightbox Settings.
3043 *
3044 * @param object $attachment image(post) object.
3045 *
3046 * @since 4.10.62
3047 *
3048 * @return string $title lightbox title.
3049 */
3050 protected function get_lightbox_title( $attachment ) {
3051 $title = '';
3052
3053 if ( ! $attachment || ! is_a( $attachment, 'WP_Post' ) ) {
3054 return $title;
3055 }
3056
3057 $image_data = array(
3058 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
3059 'caption' => $attachment->post_excerpt,
3060 'description' => $attachment->post_content,
3061 'title' => $attachment->post_title,
3062 );
3063
3064 $kit = Plugin::$instance->kits_manager->get_active_kit();
3065 $lightbox_title_src = $kit->get_settings( 'lightbox_title_src' );
3066
3067 if ( $lightbox_title_src && $image_data[ $lightbox_title_src ] ) {
3068 $lightbox_title = $image_data[ $lightbox_title_src ];
3069
3070 $title = apply_filters( 'pa_grid_image_alt', $lightbox_title );
3071 }
3072
3073 return $title;
3074 }
3075
3076 /**
3077 * Render Grid Image
3078 *
3079 * Written in PHP and used to generate the final HTML for image.
3080 *
3081 * @since 3.6.4
3082 * @access protected
3083 *
3084 * @param array $item image repeater item.
3085 * @param integer $index item index.
3086 */
3087 protected function render_grid_item( $item, $index ) {
3088
3089 $settings = $this->get_settings();
3090
3091 $image_id = apply_filters( 'wpml_object_id', $item['premium_gallery_img']['id'], 'attachment', true );
3092
3093 $image_src = $image_url = wp_get_attachment_image_url( $image_id, 'full' );
3094
3095 $is_video = $item['premium_gallery_video'];
3096
3097 $key = 'image_' . $index;
3098
3099 if ( ! empty( $item['premium_gallery_img']['url'] ) ) {
3100 $settings['image_data'] = Helper_Functions::get_image_data( $image_id, $item['premium_gallery_img']['url'], $settings['thumbnail_size'] );
3101 $image_html = Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail', 'image_data' );
3102 }
3103
3104 if ( $is_video ) {
3105
3106 $type = $item['premium_gallery_video_type'];
3107
3108 if ( 'hosted' !== $type ) {
3109 $embed_params = $this->get_embed_params( $item );
3110 $link = Embed::get_embed_url( $item['premium_gallery_video_url'], $embed_params );
3111
3112 if ( 'youtube' === $type && 'yes' === $item['privacy_mode'] ) {
3113 $link = str_replace( '.com', '-nocookie.com', $link );
3114 }
3115
3116 if ( empty( $image_html ) ) {
3117
3118 $video_props = Embed::get_video_properties( $link );
3119 $id = $video_props['video_id'];
3120 $type = $video_props['provider'];
3121 $size = '';
3122
3123 if ( 'youtube' === $type ) {
3124 $size = $settings['premium_gallery_yt_thumbnail_size'];
3125 }
3126 $image_src = Helper_Functions::get_video_thumbnail( $id, $type, $size );
3127
3128 $image_html = '<img src="' . esc_url( $image_src ) . '">';
3129 }
3130 } else {
3131 self::$check_self_hosted = true;
3132 $video_params = $this->get_hosted_params( $item );
3133 }
3134 }
3135
3136 if ( $is_video ) {
3137 ?>
3138 <div class="premium-gallery-video-wrap" data-type="<?php echo esc_attr( $item['premium_gallery_video_type'] ); ?>">
3139 <?php if ( 'hosted' !== $item['premium_gallery_video_type'] ) : ?>
3140 <div class="premium-gallery-iframe-wrap" data-src="<?php echo esc_url( $link ); ?>"></div>
3141 <?php
3142 else :
3143 $link = empty( $item['premium_gallery_video_self_url'] ) ? $item['premium_gallery_video_self']['url'] : $item['premium_gallery_video_self_url'];
3144 ?>
3145 <video src="<?php echo esc_url( $link ); ?>" <?php echo wp_kses_post( Utils::render_html_attributes( $video_params ) ); ?>></video>
3146 <?php endif; ?>
3147 </div>
3148 <?php } ?>
3149 <?php echo wp_kses_post( $image_html ); ?>
3150 <?php
3151
3152 return array(
3153 'link' => ( isset( $link ) && ! empty( $link ) ) ? $link : false,
3154 'thumbnail' => $image_src,
3155 );
3156 }
3157
3158 /**
3159 * Render Icons
3160 *
3161 * Render Lightbox and URL Icons HTML
3162 *
3163 * @since 3.6.4
3164 * @access protected
3165 *
3166 * @param array $item grid image repeater item.
3167 * @param integer $index item index.
3168 * @param string $alt image alternative text.
3169 */
3170 protected function render_icons( $item, $index, $alt ) {
3171
3172 $settings = $this->get_settings_for_display();
3173
3174 $lightbox_key = 'image_lightbox_' . $index;
3175
3176 $link_key = 'image_link_' . $index;
3177
3178 $href = $item['premium_gallery_img']['url'];
3179
3180 $lightbox = $settings['premium_gallery_light_box'];
3181
3182 $lightbox_type = $settings['premium_gallery_lightbox_type'];
3183
3184 $is_video = $item['premium_gallery_video'];
3185
3186 $id = $this->get_id();
3187
3188 if ( $is_video ) {
3189
3190 $type = $item['premium_gallery_video_type'];
3191
3192 $this->add_render_attribute(
3193 $lightbox_key,
3194 array(
3195 'class' => array(
3196 'pa-gallery-lightbox-wrap',
3197 'pa-gallery-magnific-image',
3198 'pa-gallery-video-icon',
3199 ),
3200 'tabindex' => 0,
3201 )
3202 );
3203
3204 if ( 'yes' === $lightbox ) {
3205
3206 $lightbox_options = array(
3207 'privacy' => 'yes',
3208 );
3209
3210 if ( 'default' !== $lightbox_type ) {
3211
3212 if ( 1 === count( $settings['premium_gallery_img_content'] ) || self::$check_self_hosted ) {
3213 $lightbox_options = array(
3214 'type' => 'video',
3215 'videoType' => $item['premium_gallery_video_type'],
3216 'url' => $item['video_link'],
3217 'modalOptions' => array(
3218 'id' => 'elementor-lightbox-' . $id,
3219 'videoAspectRatio' => '169',
3220 ),
3221 );
3222
3223 if ( 'hosted' === $type ) {
3224 $lightbox_options['videoParams'] = $this->get_hosted_params( $item );
3225 }
3226 }
3227
3228 $this->add_render_attribute(
3229 $lightbox_key,
3230 array(
3231 'data-elementor-open-lightbox' => 'yes',
3232 'data-elementor-lightbox' => wp_json_encode( $lightbox_options ),
3233 'data-elementor-lightbox-video' => esc_url( $item['video_link'] ),
3234 )
3235 );
3236
3237 // Make sure videos slideshow is enabled only when there are no self hosted videos
3238 // Self hosted videos causes issue with slideshow
3239 if ( ! self::$check_self_hosted ) {
3240 $this->add_render_attribute( $lightbox_key, 'data-elementor-lightbox-slideshow', count( $settings['premium_gallery_img_content'] ) > 1 ? $this->get_id() : false );
3241 }
3242 } else {
3243
3244 $rel = sprintf( 'prettyPhoto[premium-grid-%s]', $this->get_id() );
3245 $link = ( 'hosted' === $type ) ? $item['video_link'] : $item['video_link'] . '&iframe=true';
3246
3247 $this->add_render_attribute(
3248 $lightbox_key,
3249 array(
3250 'href' => esc_url( $link ),
3251 'data-rel' => $rel,
3252 )
3253 );
3254 }
3255 }
3256
3257 ?>
3258 <div>
3259 <a <?php $this->print_render_attribute_string( $lightbox_key ); ?>>
3260 <span>
3261 <?php
3262 Icons_Manager::render_icon( $settings['premium_gallery_videos_icon'], array( 'aria-hidden' => 'true' ) );
3263 ?>
3264 </span>
3265 </a>
3266 </div>
3267
3268 <?php
3269 return;
3270 }
3271
3272 if ( 'yes' === $lightbox ) {
3273
3274 if ( 'yes' !== $item['premium_gallery_lightbox_whole'] ) {
3275
3276 $this->add_render_attribute(
3277 $lightbox_key,
3278 array(
3279 'class' => 'pa-gallery-magnific-image',
3280 'href' => $href,
3281 )
3282 );
3283
3284 if ( 'default' !== $lightbox_type ) {
3285
3286 $this->add_render_attribute(
3287 $lightbox_key,
3288 array(
3289 'data-elementor-open-lightbox' => $lightbox_type,
3290 'data-elementor-lightbox-slideshow' => count( $settings['premium_gallery_img_content'] ) > 1 ? $id : false,
3291 )
3292 );
3293
3294 if ( 'yes' === $settings['lightbox_show_title'] ) {
3295
3296 $this->add_render_attribute( $lightbox_key, 'data-elementor-lightbox-title', $alt );
3297
3298 }
3299 } else {
3300
3301 $rel = sprintf( 'prettyPhoto[premium-grid-%s]', $this->get_id() );
3302
3303 $this->add_render_attribute(
3304 $lightbox_key,
3305 array(
3306 'data-rel' => $rel,
3307 )
3308 );
3309
3310 }
3311
3312 ?>
3313
3314 <a <?php $this->print_render_attribute_string( $lightbox_key ); ?>>
3315 <span>
3316 <?php
3317 Icons_Manager::render_icon( $settings['premium_gallery_lightbox_icon'], array( 'aria-hidden' => 'true' ) );
3318 ?>
3319 </span>
3320 </a>
3321 <?php
3322 }
3323 }
3324
3325 if ( ! empty( $item['premium_gallery_img_link']['url'] ) || ! empty( $item['premium_gallery_img_existing'] ) ) {
3326
3327 if ( 'yes' !== $item['premium_gallery_link_whole'] ) {
3328
3329 $this->add_render_attribute(
3330 $link_key,
3331 array(
3332 'class' => 'pa-gallery-img-link',
3333 )
3334 );
3335
3336 if ( 'url' === $item['premium_gallery_img_link_type'] ) {
3337 $icon_link = $item['premium_gallery_img_link'];
3338 } else {
3339 $icon_link = get_permalink( $item['premium_gallery_img_existing'] );
3340 }
3341
3342 if ( ! empty( $icon_link ) ) {
3343
3344 if ( 'url' === $item['premium_gallery_img_link_type'] ) {
3345 $this->add_link_attributes( $link_key, $icon_link );
3346 } else {
3347 $this->add_render_attribute( $link_key, 'href', $icon_link );
3348 }
3349
3350 ?>
3351 <a <?php $this->print_render_attribute_string( $link_key ); ?>>
3352 <span>
3353 <?php
3354 Icons_Manager::render_icon( $settings['premium_gallery_links_icon'], array( 'aria-hidden' => 'true' ) );
3355 ?>
3356 </span>
3357 </a>
3358 <?php
3359 }
3360 }
3361 }
3362 }
3363
3364 /**
3365 * Render Image Caption
3366 *
3367 * Written in PHP to render the final HTML for image title and description
3368 *
3369 * @since 3.6.4
3370 * @access protected
3371 *
3372 * @param array $item image repeater item.
3373 */
3374 protected function render_image_caption( $item ) {
3375
3376 $media_lib = $item['premmium_gallery_img_info'];
3377
3378 if ( 'yes' === $media_lib ) {
3379 $title = Control_Media::get_image_title( $item['premium_gallery_img'] );
3380
3381 $post_obj = get_post( $item['premium_gallery_img']['id'] );
3382 $description = $post_obj ? $post_obj->post_content : '';
3383 } else {
3384 $title = $item['premium_gallery_img_name'];
3385
3386 $description = $item['premium_gallery_img_desc'];
3387 }
3388
3389 if ( ! empty( $title ) || ! empty( $description ) ) :
3390 ?>
3391 <div class="premium-gallery-caption">
3392
3393 <?php if ( ! empty( $title ) ) : ?>
3394 <span class="premium-gallery-img-name"><?php echo wp_kses_post( $title ); ?></span>
3395 <?php
3396 endif;
3397
3398 if ( ! empty( $description ) ) :
3399 ?>
3400 <p class="premium-gallery-img-desc"><?php echo wp_kses_post( $description ); ?></p>
3401 <?php endif; ?>
3402
3403 </div>
3404 <?php
3405 endif;
3406 }
3407
3408 /**
3409 * Get Hosted Videos Parameters
3410 *
3411 * @since 3.7.0
3412 * @access private
3413 *
3414 * @param array $item image repeater item.
3415 */
3416 private function get_hosted_params( $item ) {
3417
3418 $video_params = array();
3419
3420 if ( $item['premium_gallery_video_controls'] ) {
3421 $video_params['controls'] = '';
3422 }
3423
3424 if ( $item['premium_gallery_video_mute'] ) {
3425 $video_params['muted'] = 'muted';
3426 }
3427
3428 if ( $item['premium_gallery_video_loop'] ) {
3429 $video_params['loop'] = '';
3430 }
3431
3432 if ( 'yes' !== $item['download_button'] ) {
3433 $video_params['controlsList'] = 'nodownload';
3434 }
3435
3436 $video_params['preload'] = 'none';
3437
3438 return $video_params;
3439 }
3440
3441 /**
3442 * Get embeded videos parameters
3443 *
3444 * @since 3.7.0
3445 * @access private
3446 *
3447 * @param array $item image repeater item.
3448 */
3449 private function get_embed_params( $item ) {
3450
3451 $video_params = array();
3452
3453 $props = Embed::get_video_properties( $item['premium_gallery_video_url'] );
3454
3455 $video_params['loop'] = $item['premium_gallery_video_loop'] ? '1' : '0';
3456
3457 $video_params['autoplay'] = '1';
3458
3459 $video_params['controls'] = $item['premium_gallery_video_controls'] ? '1' : '0';
3460
3461 $key = 'youtube' === $item['premium_gallery_video_type'] ? 'mute' : 'muted';
3462
3463 // $video_params['playlist'] = $props['video_id'];
3464
3465 $video_params[ $key ] = $item['premium_gallery_video_mute'] ? '1' : '0';
3466
3467 if ( 'vimeo' === $item['premium_gallery_video_type'] ) {
3468 $video_params['autopause'] = '0';
3469 }
3470
3471 return $video_params;
3472 }
3473
3474 /**
3475 * Render Editor Masonry Script.
3476 *
3477 * @since 3.12.3
3478 * @access protected
3479 */
3480 protected function render_editor_script() {
3481
3482 ?>
3483 <script type="text/javascript">
3484 jQuery( document ).ready( function( $ ) {
3485
3486 $( '.premium-gallery-container' ).each( function() {
3487
3488 var $node_id = '<?php echo esc_attr( $this->get_id() ); ?>',
3489 scope = $( '[data-id="' + $node_id + '"]' ),
3490 settings = $(this).data("settings"),
3491 selector = $(this);
3492
3493 if ( selector.closest( scope ).length < 1 ) {
3494 return;
3495 }
3496
3497 var masonryArgs = {
3498 // set itemSelector so .grid-sizer is not used in layout
3499 filter : settings.active_cat,
3500 itemSelector : '.premium-gallery-item',
3501 percentPosition : true,
3502 layoutMode : settings.img_size,
3503 };
3504
3505 var $isotopeObj = {};
3506
3507 selector.imagesLoaded( function() {
3508
3509 $isotopeObj = selector.isotope( masonryArgs );
3510
3511 selector.find('.premium-gallery-item').resize( function() {
3512 $isotopeObj.isotope( 'layout' );
3513 });
3514 });
3515
3516 });
3517 });
3518 </script>
3519 <?php
3520 }
3521 }
3522