PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / Elementor / widgets / loop / review / config.php
shop-press / Elementor / widgets / loop / review Last commit date
config.php 2 years ago
config.php
113 lines
1 <?php
2 namespace ShopPress\Elementor\Widgets\LoopBuilder;
3
4 use ShopPress\Elementor\ShopPressWidgets;
5 use Elementor\Controls_Manager;
6
7 defined( 'ABSPATH' ) || exit;
8
9 class Review extends ShopPressWidgets {
10
11 public function get_name() {
12 return 'sp-item-review';
13 }
14
15 public function get_title() {
16 return __( 'Product Review Count', 'shop-press' );
17 }
18
19 public function get_icon() {
20 return 'sp-widget sp-eicon-product-review';
21 }
22
23 public function get_categories() {
24 return array( 'sp_woo_loop' );
25 }
26
27 public function setup_styling_options() {
28
29 $this->register_group_styler(
30 'wrapper',
31 __( 'Wrapper', 'shop-press' ),
32 array(
33 'wrapper' => array(
34 'label' => esc_html__( 'Wrapper', 'shop-press' ),
35 'type' => 'styler',
36 'selector' => '.sp-product-review',
37 'wrapper' => '{{WRAPPER}}',
38 ),
39 )
40 );
41
42 $this->register_group_styler(
43 'review_item',
44 __( 'Review', 'shop-press' ),
45 array(
46 'rev_count' => array(
47 'label' => esc_html__( 'Review Count', 'shop-press' ),
48 'type' => 'styler',
49 'selector' => 'span.review-count',
50 'wrapper' => '{{WRAPPER}} .sp-product-review',
51 ),
52 'rev_icon' => array(
53 'label' => esc_html__( 'Review Icon', 'shop-press' ),
54 'type' => 'styler',
55 'selector' => 'i',
56 'wrapper' => '{{WRAPPER}} .sp-product-review',
57 ),
58 )
59 );
60 }
61
62 protected function register_controls() {
63 $this->start_controls_section(
64 'section_content',
65 array(
66 'label' => __( 'General', 'shop-press' ),
67 )
68 );
69
70 $this->add_control(
71 'icon',
72 array(
73 'label' => __( 'Icon', 'shop-press' ),
74 'type' => Controls_Manager::ICONS,
75 )
76 );
77
78 $this->end_controls_section();
79
80 $this->setup_styling_options();
81
82 do_action( 'shoppress/elementor/widget/register_controls_init', $this );
83 }
84
85 protected function render() {
86 $settings = $this->get_settings_for_display();
87
88 do_action( 'shoppress/widget/before_render', $settings );
89
90 $args = array(
91 'icon' => $settings['icon'],
92 );
93
94 if ( $this->editor_preview() ) {
95 sp_load_builder_template( 'loop/loop-review', $args );
96 }
97 }
98
99 protected function content_template() {
100 ?>
101 <#
102 var iconHTML = elementor.helpers.renderIcon( view, settings.icon, { 'aria-hidden': true }, 'i' , 'object' );
103 #>
104 <div class="sp-product-review">
105 {{{ iconHTML.value }}}
106 <span class="review-count">
107 2
108 </span>
109 </div>
110 <?php
111 }
112 }
113