PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.2.0
UiCore Elements – Free widgets and templates for Elementor v1.2.0
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.0, at includes/widgets/gallery-grid.php

249 lines 7.2 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 protected function register_controls()
85 {
86 $this->TRAIT_register_gallery_repeater_controls('Content');
87 $this->TRAIT_register_additional_controls();
88
89 $this->start_controls_section(
90 'grid_section',
91 [
92 'label' => esc_html__('Grid Settings', 'uicore-elements'),
93 'tab' => Controls_Manager::TAB_CONTENT,
94 ]
95 );
96
97 $this->TRAIT_register_grid_layout_controls();
98
99 $this->end_controls_section();
100
101 $this->start_controls_section(
102 'items_style_section',
103 [
104 'label' => esc_html__('Item', 'uicore-elements'),
105 'tab' => Controls_Manager::TAB_STYLE,
106 ]
107 );
108
109 $this->TRAIT_register_all_item_style_controls(false);
110
111 $this->end_controls_section();
112
113 $this->TRAIT_register_filters_style_controls();
114 $this->TRAIT_register_image_style_controls();
115 $this->TRAIT_register_title_style_controls();
116 $this->TRAIT_register_description_style_controls();
117 $this->TRAIT_register_tags_style_controls();
118 $this->TRAIT_register_badge_style_controls();
119 $this->TRAIT_register_gallery_animations();
120
121 // Update some component controls
122 $this->update_control(
123 'item_border',
124 [
125 'default' => 'none',
126 ]
127 );
128 $this->update_control(
129 'item_border_border',
130 [
131 'default' => 'none'
132 ]
133 );
134 $this->update_control(
135 'item_padding',
136 [
137 'default' => [
138 'top' => 10,
139 'right' => 10,
140 'bottom' => 10,
141 'left' => 10,
142 ],
143 'selectors' => [
144 '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
145 ],
146 ]
147 );
148 $this->update_control(
149 'item_border_radius',
150 [
151 'default' => [
152 'top' => 0,
153 'right' => 0,
154 'bottom' => 0,
155 'left' => 0,
156 'unit' => 'px',
157 ]
158 ]
159 );
160 $this->update_control(
161 'gap',
162 [
163 'default' => [
164 'size' => 35,
165 ]
166 ]
167 );
168
169 // Remove some useless component controls or group controls that can't be properly updated
170 $this->remove_control('item_background_background');
171 $this->remove_control('item_hover_background_background');
172 $this->remove_control('item_background_color');
173 $this->remove_control('item_background_image');
174 $this->remove_control('item_background_gradient');
175
176 // Inject new controls
177 $this->start_injection([
178 'of' => 'item_border_border',
179 'at' => 'before',
180 ]);
181
182 // normal background controls
183 $this->add_group_control(
184 Group_Control_Background::get_type(),
185 [
186 'name' => 'item_gallery_background',
187 'selector' => '{{WRAPPER}} .ui-e-item',
188 'condition' => [
189 'layout' => '',
190 ]
191 ]
192 );
193 $this->add_group_control(
194 Group_Control_Background::get_type(),
195 [
196 'name' => 'item_content_background',
197 'selector' => '{{WRAPPER}} .ui-e-content',
198 'condition' => [
199 'layout' => 'ui-e-overlay',
200 ]
201 ]
202 );
203
204 $this->end_injection();
205
206 $this->start_injection([
207 'of' => 'item_hover_border_color',
208 'at' => 'before',
209 ]);
210
211 // hover background controls
212 $this->add_group_control(
213 Group_Control_Background::get_type(),
214 [
215 'name' => 'item_gallery_hover_background',
216 'selector' => '{{WRAPPER}} .ui-e-item:hover',
217 'condition' => [
218 'layout' => '',
219 ]
220 ]
221 );
222 $this->add_group_control(
223 Group_Control_Background::get_type(),
224 [
225 'name' => 'item_content_hover_background',
226 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-content',
227 'condition' => [
228 'layout' => 'ui-e-overlay',
229 ]
230 ]
231 );
232
233 $this->end_injection();
234 }
235 public function render()
236 {
237 $settings = $this->get_settings_for_display();
238 $masonry = ( isset($settings['masonry']) && $settings['masonry'] === 'yes' ) ? 'ui-e-maso' : '';
239
240 $this->TRAIT_render_gallery_filters($settings);
241
242 ?>
243 <div class='ui-e-grid ui-e-items-wrp <?php echo esc_attr($masonry) ;?>'>
244 <?php $this->TRAIT_render_gallery($settings); ?>
245 </div>
246 <?php
247 }
248 }
249 \Elementor\Plugin::instance()->widgets_manager->register(new GalleryGrid());