PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.2.4
UiCore Elements – Free widgets and templates for Elementor v1.2.4
1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 41 releases
uicore-elements / includes / widgets / gallery-grid.php

gallery-grid.php in UiCore Elements – Free widgets and templates for Elementor 1.2.4, at includes/widgets/gallery-grid.php

253 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace UiCoreElements;
3
4 use Elementor\Controls_Manager;
5 use Elementor\Group_Control_Background;
6
7 use UiCoreElements\UiCoreWidget;
8 use UicoreElements\Utils\Gallery_Trait;
9 use UiCoreElements\Utils\Animation_Trait;
10 use UiCoreElements\Utils\Grid_Trait;
11 use UicoreElements\Utils\Item_Style_Component;
12
13 defined('ABSPATH') || exit();
14
15 /**
16 * Gallery Grid
17 *
18 * @author Lucas Marini Falbo <lucas95@uicore.co>
19 * @since 1.0.14
20 */
21
22 class GalleryGrid extends UiCoreWidget
23 {
24 use Animation_Trait;
25 use Grid_Trait;
26 use Gallery_Trait;
27 use Item_Style_Component;
28
29 public function get_name()
30 {
31 return 'uicore-gallery-grid';
32 }
33 public function get_title()
34 {
35 return esc_html__('Gallery Grid', 'uicore-elements');
36 }
37 public function get_icon()
38 {
39 return 'eicon-gallery-grid ui-e-widget';
40 }
41 public function get_categories()
42 {
43 return ['uicore'];
44 }
45 public function get_keywords()
46 {
47 return ['gallery', 'grid', 'content', 'box',];
48 }
49 public function get_styles()
50 {
51 $styles = [
52 'gallery-grid',
53 'grid',
54 'filters' => [
55 'condition' => [
56 'filters' => 'yes',
57 ]
58 ],
59 'animation', // hover animations
60 'entrance', // entrance basic style
61 ];
62 if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){
63 $styles['e-animations'] = [ // entrance animations
64 'external' => true,
65 ];
66 }
67 return $styles;
68 }
69 public function get_scripts()
70 {
71 return [
72 'gallery-grid' => [
73 'condition' => [
74 'filters' => 'yes'
75 ],
76 ],
77 'entrance' => [
78 'condition' => [
79 'animate_items' => 'ui-e-grid-animate'
80 ],
81 ]
82 ];
83 }
84 public function has_widget_inner_wrapper(): bool {
85 // TODO: remove after 3.30, when the full deprecation of widget innet wrapper is ready
86 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
87 }
88 protected function register_controls()
89 {
90 $this->TRAIT_register_gallery_repeater_controls('Content');
91 $this->TRAIT_register_additional_controls();
92
93 $this->start_controls_section(
94 'grid_section',
95 [
96 'label' => esc_html__('Grid Settings', 'uicore-elements'),
97 'tab' => Controls_Manager::TAB_CONTENT,
98 ]
99 );
100
101 $this->TRAIT_register_grid_layout_controls();
102
103 $this->end_controls_section();
104
105 $this->start_controls_section(
106 'items_style_section',
107 [
108 'label' => esc_html__('Item', 'uicore-elements'),
109 'tab' => Controls_Manager::TAB_STYLE,
110 ]
111 );
112
113 $this->TRAIT_register_all_item_style_controls(false);
114
115 $this->end_controls_section();
116
117 $this->TRAIT_register_filters_style_controls();
118 $this->TRAIT_register_image_style_controls();
119 $this->TRAIT_register_title_style_controls();
120 $this->TRAIT_register_description_style_controls();
121 $this->TRAIT_register_tags_style_controls();
122 $this->TRAIT_register_badge_style_controls();
123 $this->TRAIT_register_gallery_animations();
124
125 // Update some component controls
126 $this->update_control(
127 'item_border',
128 [
129 'default' => 'none',
130 ]
131 );
132 $this->update_control(
133 'item_border_border',
134 [
135 'default' => 'none'
136 ]
137 );
138 $this->update_control(
139 'item_padding',
140 [
141 'default' => [
142 'top' => 10,
143 'right' => 10,
144 'bottom' => 10,
145 'left' => 10,
146 ],
147 'selectors' => [
148 '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
149 ],
150 ]
151 );
152 $this->update_control(
153 'item_border_radius',
154 [
155 'default' => [
156 'top' => 0,
157 'right' => 0,
158 'bottom' => 0,
159 'left' => 0,
160 'unit' => 'px',
161 ]
162 ]
163 );
164 $this->update_control(
165 'gap',
166 [
167 'default' => [
168 'size' => 35,
169 ]
170 ]
171 );
172
173 // Remove some useless component controls or group controls that can't be properly updated
174 $this->remove_control('item_background_background');
175 $this->remove_control('item_hover_background_background');
176 $this->remove_control('item_background_color');
177 $this->remove_control('item_background_image');
178 $this->remove_control('item_background_gradient');
179
180 // Inject new controls
181 $this->start_injection([
182 'of' => 'item_border_border',
183 'at' => 'before',
184 ]);
185
186 // normal background controls
187 $this->add_group_control(
188 Group_Control_Background::get_type(),
189 [
190 'name' => 'item_gallery_background',
191 'selector' => '{{WRAPPER}} .ui-e-item',
192 'condition' => [
193 'layout' => '',
194 ]
195 ]
196 );
197 $this->add_group_control(
198 Group_Control_Background::get_type(),
199 [
200 'name' => 'item_content_background',
201 'selector' => '{{WRAPPER}} .ui-e-content',
202 'condition' => [
203 'layout' => 'ui-e-overlay',
204 ]
205 ]
206 );
207
208 $this->end_injection();
209
210 $this->start_injection([
211 'of' => 'item_hover_border_color',
212 'at' => 'before',
213 ]);
214
215 // hover background controls
216 $this->add_group_control(
217 Group_Control_Background::get_type(),
218 [
219 'name' => 'item_gallery_hover_background',
220 'selector' => '{{WRAPPER}} .ui-e-item:hover',
221 'condition' => [
222 'layout' => '',
223 ]
224 ]
225 );
226 $this->add_group_control(
227 Group_Control_Background::get_type(),
228 [
229 'name' => 'item_content_hover_background',
230 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-content',
231 'condition' => [
232 'layout' => 'ui-e-overlay',
233 ]
234 ]
235 );
236
237 $this->end_injection();
238 }
239 public function render()
240 {
241 $settings = $this->get_settings_for_display();
242 $masonry = $this->is_option('masonry', 'yes') ? 'ui-e-maso' : '';
243
244 $this->TRAIT_render_gallery_filters($settings);
245
246 ?>
247 <div class='ui-e-grid ui-e-items-wrp <?php echo esc_attr($masonry) ;?>'>
248 <?php $this->TRAIT_render_gallery($settings); ?>
249 </div>
250 <?php
251 }
252 }
253 \Elementor\Plugin::instance()->widgets_manager->register(new GalleryGrid());