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

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