PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / Elementor / widgets / single-product / attributes / config.php
shop-press / Elementor / widgets / single-product / attributes Last commit date
config.php 4 months ago
config.php
126 lines
1 <?php
2 namespace ShopPress\Elementor\Widgets;
3
4 use ShopPress\Elementor\ShopPressWidgets;
5 use Elementor\Controls_Manager;
6
7 defined( 'ABSPATH' ) || exit;
8
9 class Attributes extends ShopPressWidgets {
10
11 public function get_name() {
12 return 'sp-Attributes';
13 }
14
15 public function get_title() {
16 return __( 'Product Attributes', 'shop-press' );
17 }
18
19 public function get_icon() {
20 return 'sp-widget sp-eicon-product-attributes';
21 }
22
23 public function get_categories() {
24 return array( 'sp_woo_single' );
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-attributes-wrapper',
37 'wrapper' => '{{WRAPPER}}',
38 ),
39 'table' => array(
40 'label' => esc_html__( 'Container', 'shop-press' ),
41 'type' => 'styler',
42 'selector' => '.woocommerce-product-attributes',
43 'wrapper' => '{{WRAPPER}} .sp-attributes-wrapper',
44 ),
45 )
46 );
47 $this->register_group_styler(
48 'table',
49 __( 'Table', 'shop-press' ),
50 array(
51 'tbody' => array(
52 'label' => esc_html__( 'Table Body', 'shop-press' ),
53 'type' => 'styler',
54 'selector' => 'tbody',
55 'wrapper' => '{{WRAPPER}} .woocommerce-product-attributes',
56 ),
57 'tr' => array(
58 'label' => esc_html__( 'Table Row', 'shop-press' ),
59 'type' => 'styler',
60 'selector' => 'tr.woocommerce-product-attributes-item',
61 'wrapper' => '{{WRAPPER}} .woocommerce-product-attributes tbody',
62 ),
63 'th' => array(
64 'label' => esc_html__( 'Table Header', 'shop-press' ),
65 'type' => 'styler',
66 'selector' => 'th.woocommerce-product-attributes-item__label',
67 'wrapper' => '{{WRAPPER}} tr.woocommerce-product-attributes-item',
68 ),
69 'td' => array(
70 'label' => esc_html__( 'Value Wrapper', 'shop-press' ),
71 'type' => 'styler',
72 'selector' => 'td.woocommerce-product-attributes-item__value',
73 'wrapper' => '{{WRAPPER}} tr.woocommerce-product-attributes-item',
74 ),
75 'td_content' => array(
76 'label' => esc_html__( 'Value Content', 'shop-press' ),
77 'type' => 'styler',
78 'selector' => 'p',
79 'wrapper' => '{{WRAPPER}} td.woocommerce-product-attributes-item__value',
80 ),
81 'td_link' => array(
82 'label' => esc_html__( 'Link', 'shop-press' ),
83 'type' => 'styler',
84 'selector' => 'a',
85 'wrapper' => '{{WRAPPER}} td.woocommerce-product-attributes-item__value p',
86 ),
87 )
88 );
89 }
90
91 protected function register_controls() {
92 $this->setup_styling_options();
93
94 do_action( 'shoppress/elementor/widget/register_controls_init', $this );
95 }
96
97 protected function render() {
98 do_action( 'shoppress/widget/before_render', $this->get_settings_for_display() );
99
100 if ( $this->editor_preview() ) {
101 sp_load_builder_template( 'single-product/product-attributes' );
102 }
103 }
104
105 protected function content_template() {
106 ?>
107 <div class="sp-attributes-wrapper">
108 <table class="woocommerce-product-attributes shop_attributes">
109 <tbody>
110 <tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--attribute_pa_color">
111 <th class="woocommerce-product-attributes-item__label">Color</th>
112 <td class="woocommerce-product-attributes-item__value"><p>Blue, Gray, Green, Red, Yellow</p>
113 </td>
114 </tr>
115 <tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--attribute_pa_size">
116 <th class="woocommerce-product-attributes-item__label">Size</th>
117 <td class="woocommerce-product-attributes-item__value"><p>Large, Medium, Small</p>
118 </td>
119 </tr>
120 </tbody>
121 </table>
122 </div>
123 <?php
124 }
125 }
126