| 1 |
<?php |
| 2 |
namespace UiCoreElements; |
| 3 |
use Elementor\Controls_Manager; |
| 4 |
use UiCoreElements\UiCoreWidget; |
| 5 |
use UiCoreElements\Utils\Testimonial_Trait; |
| 6 |
use UiCoreElements\Utils\Animation_Trait; |
| 7 |
use UiCoreElements\Utils\Grid_Trait; |
| 8 |
use UicoreElements\Utils\Item_Style_Component; |
| 9 |
|
| 10 |
use function PHPSTORM_META\map; |
| 11 |
|
| 12 |
defined('ABSPATH') || exit(); |
| 13 |
|
| 14 |
/** |
| 15 |
* Testimonial Grid |
| 16 |
* |
| 17 |
* @author Lucas Marini Falbo <lucas95@uicore.co> |
| 18 |
* @since 1.0.1 |
| 19 |
*/ |
| 20 |
|
| 21 |
class TestimonialGrid extends UiCoreWidget |
| 22 |
{ |
| 23 |
use Testimonial_Trait; |
| 24 |
use Animation_Trait; |
| 25 |
use Grid_Trait; |
| 26 |
use Item_Style_Component; |
| 27 |
|
| 28 |
public function get_name() |
| 29 |
{ |
| 30 |
return 'uicore-testimonial-grid'; |
| 31 |
} |
| 32 |
public function get_title() |
| 33 |
{ |
| 34 |
return esc_html__('Testimonial Grid', 'uicore-elements'); |
| 35 |
} |
| 36 |
public function get_icon() |
| 37 |
{ |
| 38 |
return 'eicon-testimonial ui-e-widget'; |
| 39 |
} |
| 40 |
public function get_categories() |
| 41 |
{ |
| 42 |
return ['uicore']; |
| 43 |
} |
| 44 |
public function get_keywords() |
| 45 |
{ |
| 46 |
return ['testimonial', 'review', 'services', 'cards', 'box', 'features', 'client', 'grid']; |
| 47 |
} |
| 48 |
public function get_styles() |
| 49 |
{ |
| 50 |
$styles = [ |
| 51 |
'testimonial-grid', |
| 52 |
'animation', // hover animations |
| 53 |
'entrance', // entrance basic style |
| 54 |
]; |
| 55 |
if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ |
| 56 |
$styles['e-animations'] = [ // entrance animations |
| 57 |
'external' => true, |
| 58 |
]; |
| 59 |
} |
| 60 |
return $styles; |
| 61 |
} |
| 62 |
public function get_scripts() |
| 63 |
{ |
| 64 |
return [ |
| 65 |
'utils/global-testimonial' => [ |
| 66 |
'condition' => [ |
| 67 |
'layout' => 'layout_5' |
| 68 |
], |
| 69 |
], |
| 70 |
'entrance' => [ |
| 71 |
'condition' => [ |
| 72 |
'animate_items' => 'ui-e-grid-animate' |
| 73 |
], |
| 74 |
] |
| 75 |
]; |
| 76 |
} |
| 77 |
protected function register_controls() |
| 78 |
{ |
| 79 |
|
| 80 |
$this->TRAIT_register_testimonial_repeater_controls('Testimonial Grid Items'); // Repeater Controls |
| 81 |
|
| 82 |
$this->start_controls_section( // Specific Additional Grid Controls |
| 83 |
'section_review_additional_settings', |
| 84 |
[ |
| 85 |
'label' => __('Additional Settings', 'uicore-elements'), |
| 86 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 87 |
] |
| 88 |
); |
| 89 |
|
| 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 |
| 93 |
|
| 94 |
$this->end_controls_section(); |
| 95 |
|
| 96 |
$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 |
); |
| 103 |
|
| 104 |
$this->TRAIT_register_all_item_style_controls(false); |
| 105 |
|
| 106 |
$this->end_controls_section(); |
| 107 |
|
| 108 |
$this->TRAIT_register_style_controls(); // Other Components Style Controls |
| 109 |
|
| 110 |
$this->start_controls_section( |
| 111 |
'section_style_animations', |
| 112 |
[ |
| 113 |
'label' => __('Animations', 'uicore-elements'), |
| 114 |
'tab' => Controls_Manager::TAB_STYLE, |
| 115 |
] |
| 116 |
); |
| 117 |
|
| 118 |
$this->TRAIT_register_testimonial_animation_controls(); |
| 119 |
|
| 120 |
$this->end_controls_section(); |
| 121 |
} |
| 122 |
public function render() |
| 123 |
{ |
| 124 |
$settings = $this->get_settings_for_display(); |
| 125 |
$layout = $settings['layout']; |
| 126 |
|
| 127 |
$this->add_render_attribute('review-card', 'class', 'ui-e-grid'); |
| 128 |
?> |
| 129 |
<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); ?> |
| 132 |
<?php endforeach; ?> |
| 133 |
</div> |
| 134 |
<?php |
| 135 |
} |
| 136 |
} |
| 137 |
\Elementor\Plugin::instance()->widgets_manager->register(new TestimonialGrid()); |