PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.12
ShopBuilder – WooCommerce Builder For Elementor v2.1.12
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.12, at app/Elementor/Widgets/General/Notice.php

135 lines 3.1 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 /**
54 * @return void
55 */
56 //public static function get_notice_template( $template, $template_name ) {
57 // switch ( $template_name ) {
58 // case 'notices/success.php':
59 // case 'notices/error.php':
60 // case 'notices/notice.php':
61 // $rtsb_template = 'elementor/general/' . str_replace( '.php', '', $template_name );
62 // $template = Fns::locate_template( $rtsb_template ) ?? $template;
63 // break;
64 // }
65 // return $template;
66 //}
67
68 /**
69 * @return void
70 */
71 public function apply_the_hooks() {
72
73 }
74
75 /**
76 * Render Function
77 *
78 * @return void
79 */
80 protected function render() {
81 $this->apply_the_hooks();
82 $this->theme_support();
83
84 if ( $this->is_builder_mode() ) {
85 $all_notices = [
86 'success' => [
87 [
88 '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>',
89 'data' => [],
90 ],
91 ],
92 'error' => [
93 [
94 'notice' => esc_html__( 'This is demo preview for error notice.', 'shopbuilder' ),
95 'data' => [],
96 ],
97 ],
98 'notice' => [
99 [
100 'notice' => esc_html__( 'This is demo preview for info notice.', 'shopbuilder' ),
101 'data' => [],
102 ],
103 ],
104 ];
105
106 $notice_types = [ 'success', 'error', 'notice' ];
107
108 echo '<div class="rtsb-notice-widget"><div class="rtsb-notice"><div class="woocommerce-notices-wrapper">';
109
110 foreach ( $notice_types as $notice_type ) {
111 $messages = [];
112
113 foreach ( $all_notices[ $notice_type ] as $notice ) {
114 $messages[] = $notice['notice'] ?? $notice;
115 }
116
117 wc_get_template(
118 "notices/{$notice_type}.php",
119 [
120 'messages' => $messages,
121 'notices' => $all_notices[ $notice_type ],
122 ]
123 );
124 }
125 echo '</div></div>';
126 } else {
127 echo '<div class="rtsb-notice-widget">';
128 Fns::woocommerce_output_all_notices();
129 echo '</div>';
130 }
131
132 $this->theme_support( 'render_reset' );
133 }
134 }
135