| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace UiCoreElements; |
| 4 | + | |
| 3 | 5 | use Elementor\Controls_Manager; |
| 4 | 6 | use UiCoreElements\UiCoreWidget; |
| 5 | 7 | use UiCoreElements\Utils\Testimonial_Trait; |
| 6 | 8 | use UiCoreElements\Utils\Animation_Trait; |
| @@ -42,18 +44,19 @@ | ||
| 42 | 44 | return ['uicore']; |
| 43 | 45 | } |
| 44 | 46 | public function get_keywords() |
| 45 | 47 | { |
| 46 | - return ['testimonial', 'review', 'services', 'cards', 'box', 'features', 'testimonial', 'client', 'grid']; | |
| 48 | + return ['testimonial', 'review', 'services', 'cards', 'box', 'features', 'client', 'grid']; | |
| 47 | 49 | } |
| 48 | 50 | public function get_styles() |
| 49 | 51 | { |
| 50 | 52 | $styles = [ |
| 51 | 53 | 'testimonial-grid', |
| 54 | + 'grid', | |
| 52 | 55 | 'animation', // hover animations |
| 53 | 56 | 'entrance', // entrance basic style |
| 54 | 57 | ]; |
| 55 | - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ | |
| 58 | + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) { | |
| 56 | 59 | $styles['e-animations'] = [ // entrance animations |
| 57 | 60 | 'external' => true, |
| 58 | 61 | ]; |
| 59 | 62 | } |
| @@ -73,8 +76,13 @@ | ||
| 73 | 76 | ], |
| 74 | 77 | ] |
| 75 | 78 | ]; |
| 76 | 79 | } |
| 80 | + public function has_widget_inner_wrapper(): bool | |
| 81 | + { | |
| 82 | + // TODO: remove after Optmized Markup experiment is merged to the core | |
| 83 | + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup'); | |
| 84 | + } | |
| 77 | 85 | protected function register_controls() |
| 78 | 86 | { |
| 79 | 87 | |
| 80 | 88 | $this->TRAIT_register_testimonial_repeater_controls('Testimonial Grid Items'); // Repeater Controls |
| @@ -86,23 +94,23 @@ | ||
| 86 | 94 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 87 | 95 | ] |
| 88 | 96 | ); |
| 89 | 97 | |
| 90 | - $this->TRAIT_register_specific_testimonial_controls('layout'); | |
| 91 | - $this->TRAIT_register_grid_layout_controls(); | |
| 92 | - $this->TRAIT_register_testimonial_additional_controls(); // Content Additional Controls | |
| 98 | + $this->TRAIT_register_specific_testimonial_controls('layout'); | |
| 99 | + $this->TRAIT_register_grid_layout_controls(); | |
| 100 | + $this->TRAIT_register_testimonial_additional_controls(); // Content Additional Controls | |
| 93 | 101 | |
| 94 | 102 | $this->end_controls_section(); |
| 95 | 103 | |
| 96 | 104 | $this->start_controls_section( |
| 97 | - 'section_style_review_items', | |
| 98 | - [ | |
| 99 | - 'label' => esc_html__( 'Items', 'uicore-elements' ), | |
| 100 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 101 | - ] | |
| 102 | - ); | |
| 105 | + 'section_style_review_items', | |
| 106 | + [ | |
| 107 | + 'label' => esc_html__('Items', 'uicore-elements'), | |
| 108 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 109 | + ] | |
| 110 | + ); | |
| 103 | 111 | |
| 104 | - $this->TRAIT_register_all_item_style_controls(false); | |
| 112 | + $this->TRAIT_register_all_item_style_controls(false); | |
| 105 | 113 | |
| 106 | 114 | $this->end_controls_section(); |
| 107 | 115 | |
| 108 | 116 | $this->TRAIT_register_style_controls(); // Other Components Style Controls |
| @@ -114,9 +122,9 @@ | ||
| 114 | 122 | 'tab' => Controls_Manager::TAB_STYLE, |
| 115 | 123 | ] |
| 116 | 124 | ); |
| 117 | 125 | |
| 118 | - $this->TRAIT_register_testimonial_animation_controls(); | |
| 126 | + $this->TRAIT_register_testimonial_animation_controls(); | |
| 119 | 127 | |
| 120 | 128 | $this->end_controls_section(); |
| 121 | 129 | } |
| 122 | 130 | public function render() |
| @@ -122,16 +130,19 @@ | ||
| 122 | 130 | public function render() |
| 123 | 131 | { |
| 124 | 132 | $settings = $this->get_settings_for_display(); |
| 125 | 133 | $layout = $settings['layout']; |
| 134 | + $masonry = $this->is_option('masonry', 'yes') | |
| 135 | + ? 'ui-e-maso' | |
| 136 | + : ''; | |
| 126 | 137 | |
| 127 | - $this->add_render_attribute('review-card', 'class', 'ui-e-grid'); | |
| 128 | - ?> | |
| 138 | + $this->add_render_attribute('review-card', 'class', ['ui-e-grid', $masonry]); | |
| 139 | +?> | |
| 129 | 140 | <div <?php $this->print_render_attribute_string('review-card'); ?>> |
| 130 | - <?php foreach ( $settings['review_items'] as $index => $item ) : ?> | |
| 131 | - <?php $this->TRAIT_render_review_item($item, $layout); ?> | |
| 141 | + <?php foreach ($settings['review_items'] as $index => $item) : ?> | |
| 142 | + <?php $this->TRAIT_render_review_item($item, $layout); ?> | |
| 132 | 143 | <?php endforeach; ?> |
| 133 | 144 | </div> |
| 134 | - <?php | |
| 145 | +<?php | |
| 135 | 146 | } |
| 136 | 147 | } |
| 137 | -\Elementor\Plugin::instance()->widgets_manager->register(new TestimonialGrid()); | |
| 148 | +\Elementor\Plugin::instance()->widgets_manager->register(new TestimonialGrid()); | |