PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.2
ShopBuilder – WooCommerce Builder For Elementor v2.1.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 / General / Notice.php

Notice.php in ShopBuilder – WooCommerce Builder For Elementor 2.1.2, at app/Elementor/Widgets/General/Notice.php

115 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 ProductDescription class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\General;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
12 use RadiusTheme\SB\Elementor\Widgets\Controls\NoticeSettings;
13 use RadiusTheme\SB\Helpers\BuilderFns;
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 Description class
22 */
23 class Notice 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__( 'Notice', 'shopbuilder' );
32 $this->rtsb_base = 'rtsb-wc-notice';
33 parent::__construct( $data, $args );
34 $this->rtsb_category = 'rtsb-shopbuilder-general';
35 }
36 /**
37 * Widget Field
38 *
39 * @return array
40 */
41 public function widget_fields() {
42 return NoticeSettings::widget_fields( $this );
43 }
44 /**
45 * Set Widget Keyword.
46 *
47 * @return array
48 */
49 public function get_keywords() {
50 return [ 'Notice' ] + parent::get_keywords();
51 }
52 /**
53 * Render Function
54 *
55 * @return void
56 */
57 protected function render() {
58 $this->theme_support();
59
60 $data = [
61 'template' => 'elementor/general/notice',
62 'controllers' => $this->get_settings_for_display(),
63 ];
64
65 if ( $this->is_builder_mode() ) {
66 $all_notices = [
67 'success' => [
68 [
69 'notice' => esc_html__( 'This is demo preview for success notice.', 'shopbuilder' ) . '<a href="#" tabindex="1" class="button wc-forward">' . esc_html__( 'Demo Button', 'shopbuilder' ) . '</a>',
70 'data' => [],
71 ],
72 ],
73 'error' => [
74 [
75 'notice' => esc_html__( 'This is demo preview for error notice.', 'shopbuilder' ),
76 'data' => [],
77 ],
78 ],
79 'notice' => [
80 [
81 'notice' => esc_html__( 'This is demo preview for info notice.', 'shopbuilder' ),
82 'data' => [],
83 ],
84 ],
85 ];
86
87 $notice_types = [ 'success', 'error', 'notice' ];
88
89 echo '<div class="rtsb-notice">';
90
91 foreach ( $notice_types as $notice_type ) {
92 $messages = [];
93
94 foreach ( $all_notices[ $notice_type ] as $notice ) {
95 $messages[] = $notice['notice'] ?? $notice;
96 }
97
98 wc_get_template(
99 "notices/{$notice_type}.php",
100 [
101 'messages' => $messages,
102 'notices' => $all_notices[ $notice_type ],
103 ]
104 );
105 }
106
107 echo '</div>';
108 } else {
109 Fns::load_template( $data['template'], $data );
110 }
111
112 $this->theme_support( 'render_reset' );
113 }
114 }
115