PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.2.2
ShopBuilder – WooCommerce Builder For Elementor v2.2.2
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / Single / ProductTitle.php

ProductTitle.php in ShopBuilder – WooCommerce Builder For Elementor 2.2.2, at app/Elementor/Widgets/Single/ProductTitle.php

100 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main ProductTitle class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\Single;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
12 use RadiusTheme\SB\Elementor\Widgets\Controls\TitleSettings;
13 use RadiusTheme\SB\Elementor\Helper\ControlHelper;
14
15 // Do not allow directly accessing this file.
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit( 'This script cannot be accessed directly.' );
18 }
19
20 /**
21 * Product Title class
22 */
23 class ProductTitle extends ElementorWidgetBase {
24 /**
25 * Construct function
26 *
27 * @param array $data default array.
28 * @param mixed $args default arg.
29 */
30 public function __construct( $data = [], $args = null ) {
31 $this->rtsb_name = esc_html__( 'Product Title', 'shopbuilder' );
32 $this->rtsb_base = 'rtsb-product-title';
33 parent::__construct( $data, $args );
34 }
35 /**
36 * Widget Field
37 *
38 * @return array
39 */
40 public function widget_fields() {
41 $fields = self::general_settings() + TitleSettings::title_settings( $this );
42 unset(
43 $fields['title_style_start']['condition'],
44 );
45 return $fields;
46 }
47 /**
48 * Set Widget Keyword.
49 *
50 * @return array
51 */
52 public function general_settings() {
53 $fields = TitleSettings::general_settings();
54 $fields['general_style']['label'] = esc_html__( 'Options', 'shopbuilder' );
55 unset( $fields['show_title'] );
56 $new_fields = [
57 'product_title_html_tag' => [
58 'label' => esc_html__( 'Title HTML Tag', 'shopbuilder' ),
59 'type' => 'select',
60 'options' => ControlHelper::heading_tags(),
61 'default' => 'h2',
62 'separator' => 'default',
63 ],
64 ];
65 $fields = Fns::insert_controls( 'general_style', $fields, $new_fields, true );
66 return $fields;
67 }
68 /**
69 * Set Widget Keyword.
70 *
71 * @return array
72 */
73 public function get_keywords() {
74 return [ 'Heading', 'Name' ] + parent::get_keywords();
75 }
76 /**
77 * Render Function
78 *
79 * @return void
80 */
81 protected function render() {
82 global $post;
83 $_post = $post;
84 $controllers = $this->get_settings_for_display();
85 $this->theme_support();
86 if ( $this->is_builder_mode() ) {
87 // Overriding Global.
88 $post = get_post( Fns::get_prepared_product_id() ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
89 }
90 $data = [
91 'template' => 'elementor/single-product/title',
92 'controllers' => $controllers,
93 ];
94 Fns::load_template( $data['template'], $data );
95 $this->theme_support( 'render_reset' );
96 $post = $_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
97 }
98
99 }
100