PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / Elementor / widgets / single-product / title / config.php
shop-press / Elementor / widgets / single-product / title Last commit date
config.php 2 years ago
config.php
112 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 Title extends ShopPressWidgets {
10
11 public function get_name() {
12 return 'sp-title';
13 }
14
15 public function get_title() {
16 return __( 'Product Title', 'shop-press' );
17 }
18
19 public function get_icon() {
20 return 'sp-widget sp-eicon-product-title';
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-title-wrapper',
37 'wrapper' => '{{WRAPPER}}',
38 ),
39 )
40 );
41
42 $this->register_group_styler(
43 'heading',
44 __( 'Heading', 'shop-press' ),
45 array(
46 'heading' => array(
47 'label' => esc_html__( 'Heading', 'shop-press' ),
48 'type' => 'styler',
49 'selector' => '.product_title',
50 'wrapper' => '{{WRAPPER}} .sp-title-wrapper',
51 ),
52 )
53 );
54 }
55
56 protected function register_controls() {
57 $this->start_controls_section(
58 'section_content',
59 array(
60 'label' => __( 'General', 'shop-press' ),
61 )
62 );
63
64 $this->add_control(
65 'tag',
66 array(
67 'label' => __( 'Title HTML Tag', 'shop-press' ),
68 'type' => Controls_Manager::SELECT,
69 'default' => 'h1',
70 'options' => array(
71 'h1' => __( 'h1', 'shop-press' ),
72 'h2' => __( 'h2', 'shop-press' ),
73 'h3' => __( 'h3', 'shop-press' ),
74 'h4' => __( 'h4', 'shop-press' ),
75 'h5' => __( 'h5', 'shop-press' ),
76 'h6' => __( 'h6', 'shop-press' ),
77 ),
78 )
79 );
80
81 $this->end_controls_section();
82
83 $this->setup_styling_options();
84
85 do_action( 'shoppress/elementor/widget/register_controls_init', $this );
86 }
87
88 protected function render() {
89 $settings = $this->get_settings_for_display();
90
91 do_action( 'shoppress/widget/before_render', $settings );
92
93 $args = array(
94 'tag' => $settings['tag'],
95 );
96
97 if ( $this->editor_preview() ) {
98 sp_load_builder_template( 'single-product/product-title', $args );
99 }
100 }
101
102 protected function content_template() {
103 ?>
104 <div class="sp-title-wrapper">
105 <{{{ settings.tag }}} class="product_title entry-title">
106 Long Sleeve Tee
107 </{{{ settings.tag }}}>
108 </div>
109 <?php
110 }
111 }
112