PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.0.0
ShopBuilder – WooCommerce Builder For Elementor v1.0.0
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 / ActionsButton.php

ActionsButton.php in ShopBuilder – WooCommerce Builder For Elementor 1.0.0, at app/Elementor/Widgets/Single/ActionsButton.php

99 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 /**
4 * Main ProductDescription class.
5 *
6 * @package RadiusTheme\SB
7 */
8
9 namespace RadiusTheme\SB\Elementor\Widgets\Single;
10
11 use RadiusTheme\SB\Helpers\Fns;
12 use RadiusTheme\SB\Traits\ActionBtnTraits;
13 use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
14 use RadiusTheme\SB\Elementor\Widgets\Controls\ActionsBtnSettings;
15
16 // Do not allow directly accessing this file.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit( 'This script cannot be accessed directly.' );
19 }
20
21 /**
22 * Product Description class
23 */
24 class ActionsButton extends ElementorWidgetBase {
25 /**
26 * Action Button Traits.
27 */
28 use ActionBtnTraits;
29 /**
30 * Construct function
31 *
32 * @param array $data default array.
33 * @param mixed $args default arg.
34 */
35 public function __construct( $data = [], $args = null ) {
36 $this->rtsb_name = esc_html__( 'Actions Button', 'shopbuilder' );
37 $this->rtsb_base = 'rtsb-actions-button';
38 parent::__construct( $data, $args );
39 }
40 /**
41 * Widget Field
42 *
43 * @return array
44 */
45 public function widget_fields() {
46 $fields = ActionsBtnSettings::widget_fields( $this );
47 // error_log( print_r( Fns::selector_generator( $fields ) , true ) . "\n\n" , 3, __DIR__ . '/log.txt' );
48 return apply_filters( 'rtsb/elements/elementor/single/' . $this->rtsb_base, $fields, $this );
49 }
50 /**
51 * Set Widget Keyword.
52 *
53 * @return array
54 */
55 public function get_keywords() {
56 return [ 'Compare', 'Wishlist' ] + parent::get_keywords();
57 }
58
59 /**
60 * Render Function
61 *
62 * @return void
63 */
64 protected function render() {
65 global $post, $product;
66 $_product = $product;
67 $product = Fns::get_product();
68 $controllers = $this->get_settings_for_display();
69 $this->action_button_icon_modify();
70 $this->theme_support();
71
72 ob_start();
73 if ( ! empty( $controllers['wishlist_button'] ) ) {
74 do_action('rtsb/modules/wishlist/frontend/display' );
75 }
76 if ( ! empty( $controllers['comparison_button'] ) ) {
77 do_action('rtsb/modules/compare/frontend/display' );
78 }
79 $button_html = ob_get_clean();
80
81 if ( empty( $button_html ) && $this->is_builder_mode() ) {
82 $button_html = $this->rtsb_name;
83 }
84
85 $data = [
86 'template' => 'elementor/single-product/actions-button',
87 'controllers' => $controllers,
88 'content' => $button_html,
89 ];
90
91 Fns::load_template( $data['template'], $data );
92
93 $this->theme_support( 'render_reset' );
94
95 $product = $_product; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
96 $this->action_button_icon_set_default();
97 }
98 }
99