PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / Elementor / widgets / single-product / weight / config.php
shop-press / Elementor / widgets / single-product / weight Last commit date
config.php 2 years ago
config.php
85 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 Weight extends ShopPressWidgets {
10
11 public function get_name() {
12 return 'sp-weight';
13 }
14
15 public function get_title() {
16 return __( 'Product Weight', 'shop-press' );
17 }
18
19 public function get_icon() {
20 return 'sp-widget sp-eicon-product-weight';
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-weight-wrapper',
37 'wrapper' => '{{WRAPPER}}',
38 ),
39 )
40 );
41
42 $this->register_group_styler(
43 'weight',
44 __( 'Weight', 'shop-press' ),
45 array(
46 'weight' => array(
47 'label' => esc_html__( 'Weight', 'shop-press' ),
48 'type' => 'styler',
49 'selector' => '.value',
50 'wrapper' => '{{WRAPPER}} .sp-weight-wrapper',
51 ),
52 'weight_unit' => array(
53 'label' => esc_html__( 'unit', 'shop-press' ),
54 'type' => 'styler',
55 'selector' => '.unit',
56 'wrapper' => '{{WRAPPER}} .sp-weight-wrapper',
57 ),
58 )
59 );
60 }
61
62 protected function register_controls() {
63 $this->setup_styling_options();
64
65 do_action( 'shoppress/elementor/widget/register_controls_init', $this );
66 }
67
68 protected function render() {
69 do_action( 'shoppress/widget/before_render', $this->get_settings_for_display() );
70
71 if ( $this->editor_preview() ) {
72 sp_load_builder_template( 'single-product/product-weight' );
73 }
74 }
75
76 protected function content_template() {
77 ?>
78 <div class="sp-weight-wrapper">
79 <span class="value">1</span>
80 <sub class="unit">kg</sub>
81 </div>
82 <?php
83 }
84 }
85