| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main ProductDescription class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\Checkout; |
| 9 |
|
| 10 |
use RadiusTheme\SB\Helpers\Fns; |
| 11 |
use RadiusTheme\SB\Abstracts\ElementorWidgetBase; |
| 12 |
use RadiusTheme\SB\Elementor\Widgets\Controls\CheckoutFromSettings; |
| 13 |
|
| 14 |
// Do not allow directly accessing this file. |
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit( 'This script cannot be accessed directly.' ); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Product Description class |
| 21 |
*/ |
| 22 |
class OrderNotes extends ElementorWidgetBase { |
| 23 |
/** |
| 24 |
* Construct function |
| 25 |
* |
| 26 |
* @param array $data default array. |
| 27 |
* @param mixed $args default arg. |
| 28 |
*/ |
| 29 |
public function __construct( $data = [], $args = null ) { |
| 30 |
$this->rtsb_name = esc_html__( 'Additional information - Order Notes', 'shopbuilder' ); |
| 31 |
$this->rtsb_base = 'rtsb-order-notes'; |
| 32 |
parent::__construct( $data, $args ); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Widget Field |
| 37 |
* |
| 38 |
* @return array |
| 39 |
*/ |
| 40 |
public function widget_fields() { |
| 41 |
$fields = CheckoutFromSettings::widget_fields( $this ); |
| 42 |
unset( $fields['fields_label_style_start']['tab'] ); |
| 43 |
unset( $fields['fields_style_start']['tab'] ); |
| 44 |
return $fields; |
| 45 |
} |
| 46 |
/** |
| 47 |
* Set Widget Keyword. |
| 48 |
* |
| 49 |
* @return array |
| 50 |
*/ |
| 51 |
public function get_keywords() { |
| 52 |
return [ 'Order Notes', 'Checkout', 'Additional information' ] + parent::get_keywords(); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Render Function |
| 57 |
* |
| 58 |
* @return void |
| 59 |
*/ |
| 60 |
protected function render() { |
| 61 |
if ( $this->has_checkout_restriction() ) { |
| 62 |
return; |
| 63 |
} |
| 64 |
|
| 65 |
$this->theme_support(); |
| 66 |
|
| 67 |
$data = [ |
| 68 |
'template' => 'elementor/checkout/order-notes', |
| 69 |
'controllers' => $this->get_settings_for_display(), |
| 70 |
'checkout' => WC()->checkout(), |
| 71 |
]; |
| 72 |
|
| 73 |
if ( $this->is_builder_mode() ) { |
| 74 |
wc_load_cart(); |
| 75 |
} |
| 76 |
|
| 77 |
Fns::load_template( $data['template'], $data ); |
| 78 |
|
| 79 |
$this->theme_support( 'render_reset' ); |
| 80 |
} |
| 81 |
} |
| 82 |
|