<?php class Elementor_Sliderreview extends \Elementor\Widget_Base { public function get_name() { return 'smo_sliderreview'; } public function get_title() { return esc_html__( 'Smo Slider review', 'elementor-addon' ); } public function get_icon() { return 'eicon-featured-image'; } public function get_categories() { return [ 'basic' ]; } public function get_keywords() { return [ 'Sliderreview' ]; } protected function register_controls() { $this->start_controls_section( 'content_section', [ 'label' => esc_html__( 'Content', 'smo' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'list', [ 'label' => esc_html__( 'Repeater List', 'smo' ), 'type' => \Elementor\Controls_Manager::REPEATER, 'fields' => [ [ 'name' => 'quantity_star', 'label' => esc_html__( 'Quantity Star (max 5)', 'smo' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 1, 'max' => 5, 'step' => 1, 'default' => 5, 'label_block' => true, ], [ 'name' => 'reviews_desc', 'label' => esc_html__( 'Description reviews', 'smo' ), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'rows' => 10, 'default' => esc_html__( 'Default description', 'smo' ), 'placeholder' => esc_html__( 'Type your description here', 'smo' ), 'label_block' => true, ], [ 'name' => 'image_slider', 'label' => esc_html__( 'Image Slider', 'smo' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'width' => '', 'height' => '', ], 'label_block' => true, ], [ 'name' => 'list_name', 'label' => esc_html__( 'Name', 'smo' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__( 'Default title', 'smo' ), 'placeholder' => esc_html__( 'Type your title here', 'smo' ), 'label_block' => true, ], ], 'default' => [ ], ] ); $this->end_controls_section(); // Content Tab End } protected function render() { $settings = $this->get_settings_for_display(); if ( is_array($settings['list']) && !empty($settings['list']) ) { ?> <div class="slider-review"> <?php foreach ( $settings['list'] as $item ) { ?> <div class="detail-revews"> <a href="<?php echo esc_url($item['list_link']['url']); ?>"></a> <div class="start"> <?php for ($i = 0; $i < $item['quantity_star']; $i++) { echo '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M8 0L10.3511 4.76393L15.6085 5.52786L11.8042 9.23607L12.7023 14.4721L8 12L3.29772 14.4721L4.19577 9.23607L0.391548 5.52786L5.64886 4.76393L8 0Z" fill="#D4AE75"/> </svg> '; } ?> </div> <p class="review-desc"><?php echo $item['reviews_desc']; ?></p> <!-- <h4><a href="<?php echo esc_url($item['list_link']['url']); ?>"></a></h4> --> <span><img src="<?php echo $item['image_slider']['url'] ?>" alt=""/><?php echo $item['list_name']; ?> </span> </div> <?php } ?> </div> <?php } } }