| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main ProductDescription class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\Controls; |
| 9 |
|
| 10 |
// Do not allow directly accessing this file. |
| 11 |
use RadiusTheme\SB\Helpers\Fns; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit( 'This script cannot be accessed directly.' ); |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Product Description class |
| 19 |
*/ |
| 20 |
class CartTotalsSettings { |
| 21 |
/** |
| 22 |
* Widget Control Selectors |
| 23 |
* |
| 24 |
* @var object |
| 25 |
*/ |
| 26 |
private static $widget = []; |
| 27 |
/** |
| 28 |
* Widget Control Selectors |
| 29 |
* |
| 30 |
* @var array |
| 31 |
*/ |
| 32 |
private static $selector = []; |
| 33 |
|
| 34 |
/** |
| 35 |
* Widget Field |
| 36 |
* |
| 37 |
* @return array |
| 38 |
*/ |
| 39 |
public static function widget_fields( $widget ) { |
| 40 |
self::$widget = $widget; |
| 41 |
self::$selector = $widget->selectors; |
| 42 |
$fields = self::general_settings(); |
| 43 |
$fields += TitleSettings::title_settings( $widget ); |
| 44 |
$fields += self::order_review_table_settings( $widget ); |
| 45 |
$fields += ButtonSettings::style_settings( $widget ); |
| 46 |
$new_settings = [ |
| 47 |
'table_wrapper_border' => [ |
| 48 |
'mode' => 'group', |
| 49 |
'type' => 'border', |
| 50 |
'selector' => $widget->selectors['table_wrapper_border'], |
| 51 |
'size_units' => [ 'px' ], |
| 52 |
'fields_options' => [ |
| 53 |
'border' => [ |
| 54 |
'label' => esc_html__( 'Table Wrapper Border', 'shopbuilder' ), |
| 55 |
'label_block' => true, |
| 56 |
], |
| 57 |
'color' => [ |
| 58 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 59 |
], |
| 60 |
], |
| 61 |
], |
| 62 |
'table_wrapper_padding' => [ |
| 63 |
'label' => esc_html__( 'Table Wrapper Padding', 'shopbuilder' ), |
| 64 |
'type' => 'dimensions', |
| 65 |
'mode' => 'responsive', |
| 66 |
'size_units' => [ 'px', 'em', '%' ], |
| 67 |
'selectors' => [ |
| 68 |
$widget->selectors['table_wrapper_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 69 |
], |
| 70 |
], |
| 71 |
]; |
| 72 |
$fields = Fns::insert_controls( 'table_cell_heading', $fields, $new_settings ); |
| 73 |
|
| 74 |
return $fields; |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Widget Field |
| 79 |
* |
| 80 |
* @return array |
| 81 |
*/ |
| 82 |
public static function order_review_table_settings( $widget ) { |
| 83 |
$fields = OrderReviewTableSettings::table_settings( $widget ); |
| 84 |
$fields['total_heading_width']['label'] = __( 'Label Max Width', 'shopbuilder' ); |
| 85 |
$fields['total_cell_heading_width']['label'] = __( 'Value Max Width', 'shopbuilder' ); |
| 86 |
$fields['table_product_title']['raw'] = sprintf( |
| 87 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 88 |
esc_html__( 'Heading', 'shopbuilder' ) |
| 89 |
); |
| 90 |
$fields['table_product_total']['raw'] = sprintf( |
| 91 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 92 |
esc_html__( 'Value', 'shopbuilder' ) |
| 93 |
); |
| 94 |
|
| 95 |
return $fields; |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Widget Field |
| 100 |
* |
| 101 |
* @return array |
| 102 |
*/ |
| 103 |
public static function general_settings() { |
| 104 |
$fields = TitleSettings::general_settings(); |
| 105 |
$fields['show_title']['selectors'] = [ |
| 106 |
self::$selector['show_title'] => 'display:block;', |
| 107 |
]; |
| 108 |
$new_fields = [ |
| 109 |
'show_shipping_address' => [ |
| 110 |
'label' => esc_html__( 'Show Shipping Information?', 'shopbuilder' ), |
| 111 |
'type' => 'switch', |
| 112 |
'description' => esc_html__( 'Switch on to show shipping information.', 'shopbuilder' ), |
| 113 |
'separator' => 'default', |
| 114 |
'default' => 'yes', |
| 115 |
], |
| 116 |
]; |
| 117 |
$new_fields['table_horizontal_scroll_on_mobile'] = [ |
| 118 |
'label' => esc_html__( 'Show default Table View On Mobile?', 'shopbuilder' ), |
| 119 |
'type' => 'switch', |
| 120 |
'description' => esc_html__( 'Show default Table View On Mobile?', 'shopbuilder' ), |
| 121 |
'default' => '', |
| 122 |
'separator' => rtsb()->has_pro() ? 'default' : 'before-short', |
| 123 |
]; |
| 124 |
$new_fields['table_min_width'] = [ |
| 125 |
'mode' => 'responsive', |
| 126 |
'label' => esc_html__( 'Table Minimum Width', 'shopbuilder' ), |
| 127 |
'description' => esc_html__( 'Enter table min-width (in px),', 'shopbuilder' ), |
| 128 |
'type' => 'slider', |
| 129 |
'size_units' => [ 'px' ], |
| 130 |
'range' => [ |
| 131 |
'px' => [ |
| 132 |
'min' => 0, |
| 133 |
'max' => 1000, |
| 134 |
'step' => 5, |
| 135 |
], |
| 136 |
], |
| 137 |
'condition' => [ |
| 138 |
'table_horizontal_scroll_on_mobile' => 'yes', |
| 139 |
], |
| 140 |
'selectors' => [ |
| 141 |
self::$selector['table_min_width'] => 'min-width: {{SIZE}}{{UNIT}};', |
| 142 |
], |
| 143 |
]; |
| 144 |
|
| 145 |
return Fns::insert_controls( 'show_title', $fields, $new_fields, true ); |
| 146 |
} |
| 147 |
} |
| 148 |
|