| @@ -1,81 +1,77 @@ | ||
| 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 ShippingForm 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__( 'Shipping Form', 'shopbuilder' ); | |
| 31 | - $this->rtsb_base = 'rtsb-shipping-form'; | |
| 32 | - parent::__construct( $data, $args ); | |
| 33 | - } | |
| 34 | - /** | |
| 35 | - * Widget Field | |
| 36 | - * | |
| 37 | - * @return array | |
| 38 | - */ | |
| 39 | - public function widget_fields() { | |
| 40 | - $fields = CheckoutFromSettings::widget_fields( $this ); | |
| 41 | - unset( $fields['fields_label_style_start']['tab'] ); | |
| 42 | - unset( $fields['fields_style_start']['tab'] ); | |
| 43 | - return $fields; | |
| 44 | - } | |
| 45 | - /** | |
| 46 | - * Set Widget Keyword. | |
| 47 | - * | |
| 48 | - * @return array | |
| 49 | - */ | |
| 50 | - public function get_keywords() { | |
| 51 | - return [ 'Checkout' ] + parent::get_keywords(); | |
| 52 | - } | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * Render Function | |
| 56 | - * | |
| 57 | - * @return void | |
| 58 | - */ | |
| 59 | - protected function render() { | |
| 60 | - if ( $this->has_checkout_restriction() ) { | |
| 61 | - return; | |
| 62 | - } | |
| 63 | - | |
| 64 | - $this->theme_support(); | |
| 65 | - | |
| 66 | - $data = [ | |
| 67 | - 'template' => 'elementor/checkout/shipping-form', | |
| 68 | - 'controllers' => $this->get_settings_for_display(), | |
| 69 | - 'checkout' => WC()->checkout(), | |
| 70 | - 'is_builder' => $this->is_builder_mode(), | |
| 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 | -} | |
| 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 ShippingForm 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__( 'Shipping Form', 'shopbuilder' ); | |
| 31 | + $this->rtsb_base = 'rtsb-shipping-form'; | |
| 32 | + parent::__construct( $data, $args ); | |
| 33 | + } | |
| 34 | + /** | |
| 35 | + * Widget Field | |
| 36 | + * | |
| 37 | + * @return array | |
| 38 | + */ | |
| 39 | + public function widget_fields() { | |
| 40 | + $fields = CheckoutFromSettings::widget_fields( $this ); | |
| 41 | + unset( $fields['fields_label_style_start']['tab'] ); | |
| 42 | + unset( $fields['fields_style_start']['tab'] ); | |
| 43 | + return apply_filters( 'rtsb/elements/elementor/checkout/' . $this->rtsb_base, $fields, $this ); | |
| 44 | + } | |
| 45 | + /** | |
| 46 | + * Set Widget Keyword. | |
| 47 | + * | |
| 48 | + * @return array | |
| 49 | + */ | |
| 50 | + public function get_keywords() { | |
| 51 | + return [ 'Checkout' ] + parent::get_keywords(); | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Render Function | |
| 56 | + * | |
| 57 | + * @return void | |
| 58 | + */ | |
| 59 | + protected function render() { | |
| 60 | + $controllers = $this->get_settings_for_display(); | |
| 61 | + $this->theme_support(); | |
| 62 | + $data = [ | |
| 63 | + 'template' => 'elementor/checkout/shipping-form', | |
| 64 | + 'controllers' => $controllers, | |
| 65 | + 'checkout' => WC()->checkout(), | |
| 66 | + 'is_builder' => $this->is_builder_mode(), | |
| 67 | + ]; | |
| 68 | + | |
| 69 | + if ( $this->is_builder_mode() ) { | |
| 70 | + wc_load_cart(); | |
| 71 | + } | |
| 72 | + | |
| 73 | + Fns::load_template( $data['template'], $data ); | |
| 74 | + $this->theme_support( 'render_reset' ); | |
| 75 | + } | |
| 76 | + | |
| 77 | +} | |