| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace UiCoreElements; |
| 3 | 4 | |
| 4 | 5 | use Elementor\Controls_Manager; |
| 5 | 6 | use Elementor\Group_Control_Background; |
| @@ -49,12 +50,18 @@ | ||
| 49 | 50 | public function get_styles() |
| 50 | 51 | { |
| 51 | 52 | $styles = [ |
| 52 | 53 | 'gallery-grid', |
| 54 | + 'grid', | |
| 55 | + 'filters' => [ | |
| 56 | + 'condition' => [ | |
| 57 | + 'filters' => 'yes', | |
| 58 | + ] | |
| 59 | + ], | |
| 53 | 60 | 'animation', // hover animations |
| 54 | 61 | 'entrance', // entrance basic style |
| 55 | 62 | ]; |
| 56 | - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ | |
| 63 | + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) { | |
| 57 | 64 | $styles['e-animations'] = [ // entrance animations |
| 58 | 65 | 'external' => true, |
| 59 | 66 | ]; |
| 60 | 67 | } |
| @@ -74,8 +81,13 @@ | ||
| 74 | 81 | ], |
| 75 | 82 | ] |
| 76 | 83 | ]; |
| 77 | 84 | } |
| 85 | + public function has_widget_inner_wrapper(): bool | |
| 86 | + { | |
| 87 | + // TODO: remove after Optmized Markup experiment is merged to the core | |
| 88 | + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup'); | |
| 89 | + } | |
| 78 | 90 | protected function register_controls() |
| 79 | 91 | { |
| 80 | 92 | $this->TRAIT_register_gallery_repeater_controls('Content'); |
| 81 | 93 | $this->TRAIT_register_additional_controls(); |
| @@ -87,9 +99,9 @@ | ||
| 87 | 99 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 88 | 100 | ] |
| 89 | 101 | ); |
| 90 | 102 | |
| 91 | - $this->TRAIT_register_grid_layout_controls(); | |
| 103 | + $this->TRAIT_register_grid_layout_controls(); | |
| 92 | 104 | |
| 93 | 105 | $this->end_controls_section(); |
| 94 | 106 | |
| 95 | 107 | $this->start_controls_section( |
| @@ -99,9 +111,9 @@ | ||
| 99 | 111 | 'tab' => Controls_Manager::TAB_STYLE, |
| 100 | 112 | ] |
| 101 | 113 | ); |
| 102 | 114 | |
| 103 | - $this->TRAIT_register_all_item_style_controls(false); | |
| 115 | + $this->TRAIT_register_all_item_style_controls(false); | |
| 104 | 116 | |
| 105 | 117 | $this->end_controls_section(); |
| 106 | 118 | |
| 107 | 119 | $this->TRAIT_register_filters_style_controls(); |
| @@ -134,10 +146,10 @@ | ||
| 134 | 146 | 'bottom' => 10, |
| 135 | 147 | 'left' => 10, |
| 136 | 148 | ], |
| 137 | 149 | 'selectors' => [ |
| 138 | - '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 139 | - ], | |
| 150 | + '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 151 | + ], | |
| 140 | 152 | ] |
| 141 | 153 | ); |
| 142 | 154 | $this->update_control( |
| 143 | 155 | 'item_border_radius', |
| @@ -172,29 +184,29 @@ | ||
| 172 | 184 | 'of' => 'item_border_border', |
| 173 | 185 | 'at' => 'before', |
| 174 | 186 | ]); |
| 175 | 187 | |
| 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 | - ] | |
| 188 | + // normal background controls | |
| 189 | + $this->add_group_control( | |
| 190 | + Group_Control_Background::get_type(), | |
| 191 | + [ | |
| 192 | + 'name' => 'item_gallery_background', | |
| 193 | + 'selector' => '{{WRAPPER}} .ui-e-item', | |
| 194 | + 'condition' => [ | |
| 195 | + 'layout' => '', | |
| 185 | 196 | ] |
| 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 | - ] | |
| 197 | + ] | |
| 198 | + ); | |
| 199 | + $this->add_group_control( | |
| 200 | + Group_Control_Background::get_type(), | |
| 201 | + [ | |
| 202 | + 'name' => 'item_content_background', | |
| 203 | + 'selector' => '{{WRAPPER}} .ui-e-content', | |
| 204 | + 'condition' => [ | |
| 205 | + 'layout' => 'ui-e-overlay', | |
| 195 | 206 | ] |
| 196 | - ); | |
| 207 | + ] | |
| 208 | + ); | |
| 197 | 209 | |
| 198 | 210 | $this->end_injection(); |
| 199 | 211 | |
| 200 | 212 | $this->start_injection([ |
| @@ -201,29 +213,29 @@ | ||
| 201 | 213 | 'of' => 'item_hover_border_color', |
| 202 | 214 | 'at' => 'before', |
| 203 | 215 | ]); |
| 204 | 216 | |
| 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 | - ] | |
| 217 | + // hover background controls | |
| 218 | + $this->add_group_control( | |
| 219 | + Group_Control_Background::get_type(), | |
| 220 | + [ | |
| 221 | + 'name' => 'item_gallery_hover_background', | |
| 222 | + 'selector' => '{{WRAPPER}} .ui-e-item:hover', | |
| 223 | + 'condition' => [ | |
| 224 | + 'layout' => '', | |
| 214 | 225 | ] |
| 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 | - ] | |
| 226 | + ] | |
| 227 | + ); | |
| 228 | + $this->add_group_control( | |
| 229 | + Group_Control_Background::get_type(), | |
| 230 | + [ | |
| 231 | + 'name' => 'item_content_hover_background', | |
| 232 | + 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-content', | |
| 233 | + 'condition' => [ | |
| 234 | + 'layout' => 'ui-e-overlay', | |
| 224 | 235 | ] |
| 225 | - ); | |
| 236 | + ] | |
| 237 | + ); | |
| 226 | 238 | |
| 227 | 239 | $this->end_injection(); |
| 228 | 240 | } |
| 229 | 241 | public function render() |
| @@ -228,15 +240,16 @@ | ||
| 228 | 240 | } |
| 229 | 241 | public function render() |
| 230 | 242 | { |
| 231 | 243 | $settings = $this->get_settings_for_display(); |
| 244 | + $masonry = $this->is_option('masonry', 'yes') ? 'ui-e-maso' : ''; | |
| 232 | 245 | |
| 233 | 246 | $this->TRAIT_render_gallery_filters($settings); |
| 234 | 247 | |
| 235 | - ?> | |
| 236 | - <div class='ui-e-grid ui-e-items-wrp'> | |
| 237 | - <?php $this->TRAIT_render_gallery($settings); ?> | |
| 238 | - </div> | |
| 239 | - <?php | |
| 248 | +?> | |
| 249 | + <div class='ui-e-grid ui-e-items-wrp <?php echo esc_attr($masonry); ?>'> | |
| 250 | + <?php $this->TRAIT_render_gallery($settings); ?> | |
| 251 | + </div> | |
| 252 | +<?php | |
| 240 | 253 | } |
| 241 | 254 | } |
| 242 | -\Elementor\Plugin::instance()->widgets_manager->register(new GalleryGrid()); | |
| 255 | +\Elementor\Plugin::instance()->widgets_manager->register(new GalleryGrid()); | |