# shopbuilder/2.1.2/app/Elementor/Widgets/General/Notice.php

ShopBuilder – WooCommerce Builder For Elementor, version 2.1.2. 115 lines.

- Page: https://pluginprobe.com/plugins/shopbuilder/2.1.2/code/app/Elementor/Widgets/General/Notice.php
- Raw: https://pluginprobe.com/plugins/shopbuilder/2.1.2/raw/app/Elementor/Widgets/General/Notice.php
- Modified: 2024-01-26T10:20:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shopbuilder/2.1.2/code/app/Elementor/Widgets/General/Notice.php#L10-L20`.

```php
<?php
/**
 * Main ProductDescription class.
 *
 * @package RadiusTheme\SB
 */

namespace RadiusTheme\SB\Elementor\Widgets\General;

use RadiusTheme\SB\Helpers\Fns;
use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
use RadiusTheme\SB\Elementor\Widgets\Controls\NoticeSettings;
use RadiusTheme\SB\Helpers\BuilderFns;

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'This script cannot be accessed directly.' );
}

/**
 * Product Description class
 */
class Notice extends ElementorWidgetBase {
	/**
	 * Construct function
	 *
	 * @param array $data default array.
	 * @param mixed $args default arg.
	 */
	public function __construct( $data = [], $args = null ) {
		$this->rtsb_name = esc_html__( 'Notice', 'shopbuilder' );
		$this->rtsb_base = 'rtsb-wc-notice';
		parent::__construct( $data, $args );
		$this->rtsb_category = 'rtsb-shopbuilder-general';
	}
	/**
	 * Widget Field
	 *
	 * @return array
	 */
	public function widget_fields() {
		return NoticeSettings::widget_fields( $this );
	}
	/**
	 * Set Widget Keyword.
	 *
	 * @return array
	 */
	public function get_keywords() {
		return [ 'Notice' ] + parent::get_keywords();
	}
	/**
	 * Render Function
	 *
	 * @return void
	 */
	protected function render() {
		$this->theme_support();

		$data = [
			'template'    => 'elementor/general/notice',
			'controllers' => $this->get_settings_for_display(),
		];

		if ( $this->is_builder_mode() ) {
			$all_notices = [
				'success' => [
					[
						'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>',
						'data'   => [],
					],
				],
				'error'   => [
					[
						'notice' => esc_html__( 'This is demo preview for error notice.', 'shopbuilder' ),
						'data'   => [],
					],
				],
				'notice'  => [
					[
						'notice' => esc_html__( 'This is demo preview for info notice.', 'shopbuilder' ),
						'data'   => [],
					],
				],
			];

			$notice_types = [ 'success', 'error', 'notice' ];

			echo '<div class="rtsb-notice">';

			foreach ( $notice_types as $notice_type ) {
				$messages = [];

				foreach ( $all_notices[ $notice_type ] as $notice ) {
					$messages[] = $notice['notice'] ?? $notice;
				}

				wc_get_template(
					"notices/{$notice_type}.php",
					[
						'messages' => $messages,
						'notices'  => $all_notices[ $notice_type ],
					]
				);
			}

			echo '</div>';
		} else {
			Fns::load_template( $data['template'], $data );
		}

		$this->theme_support( 'render_reset' );
	}
}

```
