| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main ProductDescription class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\Controls; |
| 9 |
|
| 10 |
use Elementor\Controls_Manager; |
| 11 |
use RadiusTheme\SB\Helpers\Fns; |
| 12 |
|
| 13 |
// Do not allow directly accessing this file. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit( 'This script cannot be accessed directly.' ); |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Product Description class |
| 20 |
*/ |
| 21 |
class OrderReviewSettings { |
| 22 |
/** |
| 23 |
* Widget Control Selectors |
| 24 |
* |
| 25 |
* @var object |
| 26 |
*/ |
| 27 |
private static $widget = []; |
| 28 |
/** |
| 29 |
* Widget Control Selectors |
| 30 |
* |
| 31 |
* @var array |
| 32 |
*/ |
| 33 |
private static $selectors = []; |
| 34 |
|
| 35 |
/** |
| 36 |
* Controls Settings |
| 37 |
* |
| 38 |
* @param object $widget widget object. |
| 39 |
* |
| 40 |
* @return array |
| 41 |
*/ |
| 42 |
public static function widget_fields( $widget ) { |
| 43 |
self::$widget = $widget; |
| 44 |
self::$selectors = self::$widget->selectors; |
| 45 |
|
| 46 |
return self::general_settings() + TitleSettings::title_settings( self::$widget ) + self::review_tables(); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Widget Field |
| 51 |
* |
| 52 |
* @return array |
| 53 |
*/ |
| 54 |
public static function general_settings() { |
| 55 |
// The function will Overwrite. |
| 56 |
$fields = TitleSettings::general_settings(); |
| 57 |
|
| 58 |
$new_fields['table_horizontal_scroll_on_mobile'] = [ |
| 59 |
'label' => esc_html__( 'Show default Table View On Mobile?', 'shopbuilder' ), |
| 60 |
'type' => 'switch', |
| 61 |
'description' => esc_html__( 'Show default Table View On Mobile?', 'shopbuilder' ), |
| 62 |
'default' => '', |
| 63 |
'separator' => rtsb()->has_pro() ? 'default' : 'before-short', |
| 64 |
]; |
| 65 |
$new_fields['table_min_width'] = [ |
| 66 |
'mode' => 'responsive', |
| 67 |
'label' => esc_html__( 'Table Minimum Width', 'shopbuilder' ), |
| 68 |
'description' => esc_html__( 'Enter table min-width (in px),', 'shopbuilder' ), |
| 69 |
'type' => 'slider', |
| 70 |
'size_units' => [ 'px' ], |
| 71 |
'range' => [ |
| 72 |
'px' => [ |
| 73 |
'min' => 0, |
| 74 |
'max' => 1000, |
| 75 |
'step' => 5, |
| 76 |
], |
| 77 |
], |
| 78 |
'condition' => [ |
| 79 |
'table_horizontal_scroll_on_mobile' => 'yes', |
| 80 |
], |
| 81 |
'selectors' => [ |
| 82 |
self::$selectors['table_min_width'] => 'min-width: {{SIZE}}{{UNIT}};', |
| 83 |
], |
| 84 |
]; |
| 85 |
|
| 86 |
return Fns::insert_controls( 'show_title', $fields, $new_fields, true ); |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* Widget Field |
| 91 |
* |
| 92 |
* @return array |
| 93 |
*/ |
| 94 |
public static function review_tables(): array { |
| 95 |
// The function will Overwrite. |
| 96 |
return [ |
| 97 |
'review_table_start' => [ |
| 98 |
'mode' => 'section_start', |
| 99 |
'tab' => 'style', |
| 100 |
'label' => esc_html__( 'Review Table', 'shopbuilder' ), |
| 101 |
], |
| 102 |
|
| 103 |
'table_wrapper_border' => [ |
| 104 |
'mode' => 'group', |
| 105 |
'type' => 'border', |
| 106 |
'selector' => self::$selectors['table_wrapper_border'], |
| 107 |
'size_units' => [ 'px' ], |
| 108 |
'separator' => 'default', |
| 109 |
'fields_options' => [ |
| 110 |
'border' => [ |
| 111 |
'label' => esc_html__( 'Table Wrapper Border', 'shopbuilder' ), |
| 112 |
'label_block' => true, |
| 113 |
'default' => 'solid', |
| 114 |
], |
| 115 |
'width' => [ |
| 116 |
'default' => [ |
| 117 |
'top' => '0', |
| 118 |
'right' => '0', |
| 119 |
'bottom' => '0', |
| 120 |
'left' => '0', |
| 121 |
'isLinked' => true, |
| 122 |
], |
| 123 |
], |
| 124 |
'color' => [ |
| 125 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 126 |
], |
| 127 |
], |
| 128 |
], |
| 129 |
|
| 130 |
'table_border' => [ |
| 131 |
'mode' => 'group', |
| 132 |
'type' => 'border', |
| 133 |
'selector' => self::$selectors['table_border'], |
| 134 |
'size_units' => [ 'px' ], |
| 135 |
'separator' => 'default', |
| 136 |
'fields_options' => [ |
| 137 |
'border' => [ |
| 138 |
'label' => esc_html__( 'Table Cell Border', 'shopbuilder' ), |
| 139 |
'label_block' => true, |
| 140 |
], |
| 141 |
'color' => [ |
| 142 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 143 |
], |
| 144 |
], |
| 145 |
], |
| 146 |
|
| 147 |
'table_wrapper_padding' => [ |
| 148 |
'label' => esc_html__( 'Wrapper Padding (px)', 'shopbuilder' ), |
| 149 |
'type' => 'dimensions', |
| 150 |
'mode' => 'responsive', |
| 151 |
'size_units' => [ 'px' ], |
| 152 |
'default' => [ |
| 153 |
'top' => '0', |
| 154 |
'right' => '0', |
| 155 |
'bottom' => '0', |
| 156 |
'left' => '0', |
| 157 |
'unit' => 'px', |
| 158 |
'isLinked' => true, |
| 159 |
], |
| 160 |
'selectors' => [ |
| 161 |
self::$selectors['table_wrapper_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 162 |
], |
| 163 |
], |
| 164 |
'table_wrapper_margin' => [ |
| 165 |
'label' => esc_html__( 'Wrapper Margin (px)', 'shopbuilder' ), |
| 166 |
'type' => 'dimensions', |
| 167 |
'mode' => 'responsive', |
| 168 |
'size_units' => [ 'px' ], |
| 169 |
'selectors' => [ |
| 170 |
self::$selectors['table_wrapper_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 171 |
], |
| 172 |
], |
| 173 |
|
| 174 |
'table_label' => [ |
| 175 |
'type' => 'html', |
| 176 |
'raw' => sprintf( |
| 177 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 178 |
esc_html__( 'Label', 'shopbuilder' ) |
| 179 |
), |
| 180 |
'content_classes' => 'elementor-panel-heading-title', |
| 181 |
'separator' => 'default', |
| 182 |
], |
| 183 |
'label_typo' => [ |
| 184 |
'mode' => 'group', |
| 185 |
'type' => 'typography', |
| 186 |
'label' => esc_html__( 'Label Typography', 'shopbuilder' ), |
| 187 |
'selector' => self::$selectors['label_typo'], |
| 188 |
], |
| 189 |
'label_color' => [ |
| 190 |
'label' => esc_html__( 'Label Color', 'shopbuilder' ), |
| 191 |
'type' => 'color', |
| 192 |
'selectors' => [ |
| 193 |
self::$selectors['label_color'] => 'color: {{VALUE}} !important;', |
| 194 |
], |
| 195 |
], |
| 196 |
'label_item_padding' => [ |
| 197 |
'label' => esc_html__( 'Item Padding (px)', 'shopbuilder' ), |
| 198 |
'type' => 'dimensions', |
| 199 |
'mode' => 'responsive', |
| 200 |
'size_units' => [ 'px' ], |
| 201 |
'selectors' => [ |
| 202 |
self::$selectors['label_item_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 203 |
], |
| 204 |
], |
| 205 |
|
| 206 |
'label_bg_color' => [ |
| 207 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 208 |
'type' => 'color', |
| 209 |
'alpha' => true, |
| 210 |
'selectors' => [ |
| 211 |
self::$selectors['label_bg_color'] => 'background-color: {{VALUE}};', |
| 212 |
], |
| 213 |
], |
| 214 |
'table_body' => [ |
| 215 |
'type' => 'html', |
| 216 |
'raw' => sprintf( |
| 217 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 218 |
esc_html__( 'Table Body', 'shopbuilder' ) |
| 219 |
), |
| 220 |
'content_classes' => 'elementor-panel-heading-title', |
| 221 |
'separator' => 'default', |
| 222 |
], |
| 223 |
'body_text_typo' => [ |
| 224 |
'mode' => 'group', |
| 225 |
'type' => 'typography', |
| 226 |
'label' => esc_html__( 'Typography', 'shopbuilder' ), |
| 227 |
'selector' => self::$selectors['body_text_typo'], |
| 228 |
], |
| 229 |
'table_text_color' => [ |
| 230 |
'label' => esc_html__( 'Body Text Color', 'shopbuilder' ), |
| 231 |
'type' => 'color', |
| 232 |
'selectors' => [ |
| 233 |
self::$selectors['body_text_color'] => 'color: {{VALUE}} !important;', |
| 234 |
], |
| 235 |
], |
| 236 |
'table_body_bg_color' => [ |
| 237 |
'label' => esc_html__( 'Table Body Background Color', 'shopbuilder' ), |
| 238 |
'type' => 'color', |
| 239 |
'alpha' => true, |
| 240 |
'selectors' => [ |
| 241 |
self::$selectors['table_body_bg_color'] => 'background-color: {{VALUE}};', |
| 242 |
], |
| 243 |
], |
| 244 |
'body_item_padding' => [ |
| 245 |
'label' => esc_html__( 'Item Padding (px)', 'shopbuilder' ), |
| 246 |
'type' => 'dimensions', |
| 247 |
'mode' => 'responsive', |
| 248 |
'size_units' => [ 'px' ], |
| 249 |
'selectors' => [ |
| 250 |
self::$selectors['body_item_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 251 |
], |
| 252 |
], |
| 253 |
'counter_text_color' => [ |
| 254 |
'label' => esc_html__( 'Counter Text Color', 'shopbuilder' ), |
| 255 |
'type' => 'color', |
| 256 |
'selectors' => [ |
| 257 |
self::$selectors['counter_text_color'] => 'color: {{VALUE}} !important;', |
| 258 |
], |
| 259 |
], |
| 260 |
'counter_style' => [ |
| 261 |
'label' => esc_html__( 'Counter Style', 'shopbuilder' ), |
| 262 |
'type' => 'choose', |
| 263 |
'default' => 'column', |
| 264 |
'options' => [ |
| 265 |
'auto' => [ |
| 266 |
'title' => esc_html__( 'Inline', 'shopbuilder' ), |
| 267 |
'icon' => 'eicon-ellipsis-h', |
| 268 |
], |
| 269 |
'100%' => [ |
| 270 |
'title' => esc_html__( 'New Line', 'shopbuilder' ), |
| 271 |
'icon' => 'eicon-editor-list-ul', |
| 272 |
], |
| 273 |
], |
| 274 |
'selectors' => [ |
| 275 |
self::$selectors['counter_style'] => 'width:{{VALUE}};', |
| 276 |
], |
| 277 |
], |
| 278 |
'table_footer' => [ |
| 279 |
'type' => 'html', |
| 280 |
'raw' => sprintf( |
| 281 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 282 |
esc_html__( 'Table Footer', 'shopbuilder' ) |
| 283 |
), |
| 284 |
'content_classes' => 'elementor-panel-heading-title', |
| 285 |
'separator' => 'default', |
| 286 |
], |
| 287 |
'table_footer_label_typo' => [ |
| 288 |
'mode' => 'group', |
| 289 |
'type' => 'typography', |
| 290 |
'label' => esc_html__( 'Footer Typography', 'shopbuilder' ), |
| 291 |
'selector' => self::$selectors['table_footer_label_typo'], |
| 292 |
], |
| 293 |
'table_footer_label_color' => [ |
| 294 |
'label' => esc_html__( 'Label Color', 'shopbuilder' ), |
| 295 |
'type' => 'color', |
| 296 |
'selectors' => [ |
| 297 |
self::$selectors['table_footer_label_color'] => 'color: {{VALUE}} !important;', |
| 298 |
], |
| 299 |
], |
| 300 |
|
| 301 |
'table_footer_text_color' => [ |
| 302 |
'label' => esc_html__( 'Value Color', 'shopbuilder' ), |
| 303 |
'type' => 'color', |
| 304 |
'selectors' => [ |
| 305 |
self::$selectors['table_footer_text_color'] => 'color: {{VALUE}} !important;', |
| 306 |
], |
| 307 |
], |
| 308 |
'table_footer_label_bg_color' => [ |
| 309 |
'label' => esc_html__( 'Footer Background Color', 'shopbuilder' ), |
| 310 |
'type' => 'color', |
| 311 |
'alpha' => true, |
| 312 |
'selectors' => [ |
| 313 |
self::$selectors['table_footer_label_bg_color'] => 'background-color: {{VALUE}};', |
| 314 |
], |
| 315 |
], |
| 316 |
'table_footer_item_padding' => [ |
| 317 |
'label' => esc_html__( 'Item Padding (px)', 'shopbuilder' ), |
| 318 |
'type' => 'dimensions', |
| 319 |
'mode' => 'responsive', |
| 320 |
'size_units' => [ 'px' ], |
| 321 |
'selectors' => [ |
| 322 |
self::$selectors['table_footer_item_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 323 |
], |
| 324 |
], |
| 325 |
'review_table_end' => [ |
| 326 |
'mode' => 'section_end', |
| 327 |
], |
| 328 |
]; |
| 329 |
} |
| 330 |
} |
| 331 |
|