| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Main ProductDescription class. |
| 5 |
* |
| 6 |
* @package RadiusTheme\SB |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace RadiusTheme\SB\Elementor\Widgets\Controls; |
| 10 |
|
| 11 |
use Elementor\Controls_Manager; |
| 12 |
use RadiusTheme\SB\Elementor\Helper\ControlHelper; |
| 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 ProductTabsSettings { |
| 23 |
/** |
| 24 |
* Widget Control Selectors |
| 25 |
* |
| 26 |
* @var array |
| 27 |
*/ |
| 28 |
private static $selectors = []; |
| 29 |
|
| 30 |
/** |
| 31 |
* Widget Field |
| 32 |
* |
| 33 |
* @return array |
| 34 |
*/ |
| 35 |
public static function widget_fields( $widget ) { |
| 36 |
self::$selectors = $widget->selectors; |
| 37 |
|
| 38 |
return self::general( $widget ) + |
| 39 |
self::nav_style( $widget ) + |
| 40 |
self::tab_content( $widget ) + |
| 41 |
self::additional_info( $widget ) + |
| 42 |
ReviewsSettings::widget_fields( $widget ); |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Widget Field |
| 47 |
* |
| 48 |
* @return array |
| 49 |
*/ |
| 50 |
public static function general( $widget ) { |
| 51 |
$fields = [ |
| 52 |
'general_section' => [ |
| 53 |
'mode' => 'section_start', |
| 54 |
'label' => esc_html__( 'General', 'shopbuilder' ), |
| 55 |
], |
| 56 |
'layout_style' => [ |
| 57 |
'label' => esc_html__( 'Layout', 'shopbuilder' ), |
| 58 |
'type' => 'rtsb-image-selector', |
| 59 |
'options' => ControlHelper::single_product_tab_layouts(), |
| 60 |
'default' => 'default', |
| 61 |
'separator' => 'default', |
| 62 |
], |
| 63 |
'description_note' => $widget->el_heading( esc_html__( 'Description Tab', 'shopbuilder' ), 'before' ), |
| 64 |
'description' => [ |
| 65 |
'label' => esc_html__( 'Description', 'shopbuilder' ), |
| 66 |
'type' => 'switch', |
| 67 |
'description' => esc_html__( 'Switch on to show description.', 'shopbuilder' ), |
| 68 |
'default' => 'yes', |
| 69 |
], |
| 70 |
'description_nav_text' => [ |
| 71 |
'label' => esc_html__( 'Custom Nav Text', 'shopbuilder' ), |
| 72 |
'type' => 'text', |
| 73 |
'label_block' => true, |
| 74 |
'default' => esc_html__( 'Description', 'shopbuilder' ), |
| 75 |
'description' => esc_html__( 'Leave empty for default text.', 'shopbuilder' ), |
| 76 |
'condition' => [ |
| 77 |
'description' => 'yes', |
| 78 |
], |
| 79 |
], |
| 80 |
'description_title_text' => [ |
| 81 |
'label' => esc_html__( 'Custom Title', 'shopbuilder' ), |
| 82 |
'type' => 'text', |
| 83 |
'default' => __( 'Description', 'shopbuilder' ), |
| 84 |
'description' => esc_html__( 'Leave empty for hide the title.', 'shopbuilder' ), |
| 85 |
'label_block' => true, |
| 86 |
'condition' => [ |
| 87 |
'description' => 'yes', |
| 88 |
], |
| 89 |
], |
| 90 |
'additional_information_note' => $widget->el_heading( esc_html__( 'Additional information Tab', 'shopbuilder' ), 'before' ), |
| 91 |
'additional_information' => [ |
| 92 |
'label' => esc_html__( 'Additional information', 'shopbuilder' ), |
| 93 |
'type' => 'switch', |
| 94 |
'description' => esc_html__( 'Switch on to show Additional information.', 'shopbuilder' ), |
| 95 |
'default' => 'yes', |
| 96 |
], |
| 97 |
'additional_information_nav_text' => [ |
| 98 |
'label' => esc_html__( 'Custom Nav Text', 'shopbuilder' ), |
| 99 |
'type' => 'text', |
| 100 |
'label_block' => true, |
| 101 |
'default' => esc_html__( 'Additional information', 'shopbuilder' ), |
| 102 |
'description' => esc_html__( 'Leave empty for default text.', 'shopbuilder' ), |
| 103 |
'condition' => [ |
| 104 |
'additional_information' => 'yes', |
| 105 |
], |
| 106 |
], |
| 107 |
'additional_information_title_text' => [ |
| 108 |
'label' => esc_html__( 'Custom Title', 'shopbuilder' ), |
| 109 |
'type' => 'text', |
| 110 |
'default' => __( 'Additional information', 'shopbuilder' ), |
| 111 |
'label_block' => true, |
| 112 |
'description' => esc_html__( 'Leave empty for hide the title.', 'shopbuilder' ), |
| 113 |
'condition' => [ |
| 114 |
'additional_information' => 'yes', |
| 115 |
], |
| 116 |
], |
| 117 |
'reviews_note' => $widget->el_heading( esc_html__( 'Reviews Tab', 'shopbuilder' ), 'before' ), |
| 118 |
'reviews' => [ |
| 119 |
'label' => esc_html__( 'Reviews', 'shopbuilder' ), |
| 120 |
'type' => 'switch', |
| 121 |
'description' => esc_html__( 'Switch on to show Reviews.', 'shopbuilder' ), |
| 122 |
'default' => '', |
| 123 |
], |
| 124 |
'reviews_nav_text' => [ |
| 125 |
'label' => esc_html__( 'Custom Nav Text', 'shopbuilder' ), |
| 126 |
'type' => 'text', |
| 127 |
'label_block' => true, |
| 128 |
'default' => __( 'Reviews', 'shopbuilder' ), |
| 129 |
'description' => esc_html__( 'Leave empty for default text.', 'shopbuilder' ), |
| 130 |
'condition' => [ |
| 131 |
'reviews' => 'yes', |
| 132 |
], |
| 133 |
], |
| 134 |
// No Option Found for remove title Check: /woocommerce/templates/single-product-reviews.php |
| 135 |
// 'reviews_title_text' => [ |
| 136 |
// 'label' => esc_html__( 'Reviews title text', 'shopbuilder' ), |
| 137 |
// 'type' => 'text', |
| 138 |
// 'default' => __( 'Reviews', 'shopbuilder' ), |
| 139 |
// 'label_block' => true, |
| 140 |
// 'condition' => [ |
| 141 |
// 'reviews' => 'yes', |
| 142 |
// ], |
| 143 |
// ], |
| 144 |
'general_section_end' => [ |
| 145 |
'mode' => 'section_end', |
| 146 |
], |
| 147 |
]; |
| 148 |
|
| 149 |
return $fields; |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* Widget Field |
| 154 |
* |
| 155 |
* @return array |
| 156 |
*/ |
| 157 |
public static function nav_style( $widget ) { |
| 158 |
$fields = [ |
| 159 |
'nav_style' => [ |
| 160 |
'mode' => 'section_start', |
| 161 |
'tab' => 'style', |
| 162 |
'label' => esc_html__( 'Nav Style', 'shopbuilder' ), |
| 163 |
'condition' => [ |
| 164 |
'layout_style!' => [ 'custom-layout1' ], |
| 165 |
], |
| 166 |
], |
| 167 |
'nav_typography' => [ |
| 168 |
'mode' => 'group', |
| 169 |
'type' => 'typography', |
| 170 |
'label' => esc_html__( 'Typography', 'shopbuilder' ), |
| 171 |
'selector' => $widget->selectors['nav_typography'], |
| 172 |
], |
| 173 |
'nav_position' => [ |
| 174 |
'label' => esc_html__( 'Position', 'shopbuilder' ), |
| 175 |
'mode' => 'responsive', |
| 176 |
'type' => 'slider', |
| 177 |
'range' => [ |
| 178 |
'px' => [ |
| 179 |
'min' => 0, |
| 180 |
'max' => 300, |
| 181 |
], |
| 182 |
], |
| 183 |
'condition' => [ |
| 184 |
'layout_style' => [ 'custom-layout2' ], |
| 185 |
], |
| 186 |
'selectors' => [ |
| 187 |
$widget->selectors['nav_position'] => 'top: -{{SIZE}}{{UNIT}};', |
| 188 |
], |
| 189 |
], |
| 190 |
'nav_tabs_start' => [ |
| 191 |
'mode' => 'tabs_start', |
| 192 |
], |
| 193 |
// Tab For normal view. |
| 194 |
'nav_normal' => [ |
| 195 |
'mode' => 'tab_start', |
| 196 |
'label' => esc_html__( 'Normal', 'shopbuilder' ), |
| 197 |
], |
| 198 |
'nav_color' => [ |
| 199 |
'label' => esc_html__( 'Menu color', 'shopbuilder' ), |
| 200 |
'type' => 'color', |
| 201 |
'separator' => 'default', |
| 202 |
'selectors' => [ |
| 203 |
$widget->selectors['nav_color'] => 'color: {{VALUE}}', |
| 204 |
], |
| 205 |
], |
| 206 |
'nav_bg_color' => [ |
| 207 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 208 |
'type' => 'color', |
| 209 |
'default' => '', |
| 210 |
'alpha' => true, |
| 211 |
'selectors' => [ |
| 212 |
$widget->selectors['nav_bg_color'] => 'background: {{VALUE}};', |
| 213 |
], |
| 214 |
], |
| 215 |
|
| 216 |
'nav_border' => [ |
| 217 |
'mode' => 'group', |
| 218 |
'type' => 'border', |
| 219 |
'selector' => $widget->selectors['nav_border'], |
| 220 |
'size_units' => [ 'px' ], |
| 221 |
], |
| 222 |
|
| 223 |
'nav_active_color' => [ |
| 224 |
'label' => esc_html__( 'Active Menu color', 'shopbuilder' ), |
| 225 |
'type' => 'color', |
| 226 |
'selectors' => [ |
| 227 |
$widget->selectors['nav_active_color'] => 'color: {{VALUE}}', |
| 228 |
], |
| 229 |
], |
| 230 |
|
| 231 |
'nav_active_bg_color' => [ |
| 232 |
'label' => esc_html__( 'Active Background Color', 'shopbuilder' ), |
| 233 |
'type' => 'color', |
| 234 |
'default' => '', |
| 235 |
'alpha' => true, |
| 236 |
'selectors' => [ |
| 237 |
$widget->selectors['nav_active_bg_color'] => 'background: {{VALUE}};', |
| 238 |
], |
| 239 |
], |
| 240 |
|
| 241 |
'nav_active_border_color' => [ |
| 242 |
'label' => esc_html__( 'Active Border color', 'shopbuilder' ), |
| 243 |
'type' => 'color', |
| 244 |
'selectors' => [ |
| 245 |
$widget->selectors['nav_active_border_color'] => 'border-color: {{VALUE}}', |
| 246 |
], |
| 247 |
], |
| 248 |
|
| 249 |
'nav_normal_end' => [ |
| 250 |
'mode' => 'tab_end', |
| 251 |
], |
| 252 |
'nav_hover' => [ |
| 253 |
'mode' => 'tab_start', |
| 254 |
'label' => esc_html__( 'Hover', 'shopbuilder' ), |
| 255 |
], |
| 256 |
'nav_hover_color' => [ |
| 257 |
'label' => esc_html__( 'Menu color', 'shopbuilder' ), |
| 258 |
'type' => 'color', |
| 259 |
|
| 260 |
'separator' => 'default', |
| 261 |
'selectors' => [ |
| 262 |
$widget->selectors['nav_hover_color'] => 'color: {{VALUE}}', |
| 263 |
], |
| 264 |
], |
| 265 |
'nav_hover_bg_color' => [ |
| 266 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 267 |
'type' => 'color', |
| 268 |
'default' => '', |
| 269 |
|
| 270 |
'selectors' => [ |
| 271 |
$widget->selectors['nav_hover_bg_color'] => 'background: {{VALUE}};', |
| 272 |
], |
| 273 |
], |
| 274 |
'nav_active_hover_color' => [ |
| 275 |
'label' => esc_html__( 'Active Menu color', 'shopbuilder' ), |
| 276 |
'type' => 'color', |
| 277 |
'selectors' => [ |
| 278 |
$widget->selectors['nav_active_hover_color'] => 'color: {{VALUE}}', |
| 279 |
], |
| 280 |
], |
| 281 |
'nav_active_hover_bg_color' => [ |
| 282 |
'label' => esc_html__( 'Active Background Color', 'shopbuilder' ), |
| 283 |
'type' => 'color', |
| 284 |
'default' => '', |
| 285 |
|
| 286 |
'selectors' => [ |
| 287 |
$widget->selectors['nav_active_hover_bg_color'] => 'background: {{VALUE}};', |
| 288 |
], |
| 289 |
], |
| 290 |
'nav_active_hover_border_color' => [ |
| 291 |
'label' => esc_html__( 'Active Border color', 'shopbuilder' ), |
| 292 |
'type' => 'color', |
| 293 |
'selectors' => [ |
| 294 |
$widget->selectors['nav_active_hover_border_color'] => 'border-bottom-color: {{VALUE}}', |
| 295 |
], |
| 296 |
], |
| 297 |
'nav_hover_end' => [ |
| 298 |
'mode' => 'tab_end', |
| 299 |
], |
| 300 |
'nav_tabs_end' => [ |
| 301 |
'mode' => 'tabs_end', |
| 302 |
], |
| 303 |
'nav_padding' => [ |
| 304 |
'label' => esc_html__( 'Padding', 'shopbuilder' ), |
| 305 |
'type' => 'dimensions', |
| 306 |
'mode' => 'responsive', |
| 307 |
'size_units' => [ 'px' ], |
| 308 |
'selectors' => [ |
| 309 |
$widget->selectors['nav_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 310 |
], |
| 311 |
], |
| 312 |
'nav_style_end' => [ |
| 313 |
'mode' => 'section_end', |
| 314 |
], |
| 315 |
]; |
| 316 |
|
| 317 |
return $fields; |
| 318 |
} |
| 319 |
|
| 320 |
|
| 321 |
/** |
| 322 |
* Widget Field |
| 323 |
* |
| 324 |
* @return array |
| 325 |
*/ |
| 326 |
public static function tab_content( $widget ) { |
| 327 |
$fields = [ |
| 328 |
'tab_content_style' => [ |
| 329 |
'mode' => 'section_start', |
| 330 |
'tab' => 'style', |
| 331 |
'label' => esc_html__( 'Tab Content', 'shopbuilder' ), |
| 332 |
], |
| 333 |
'content_padding' => [ |
| 334 |
'label' => esc_html__( 'Padding', 'shopbuilder' ), |
| 335 |
'type' => 'dimensions', |
| 336 |
'mode' => 'responsive', |
| 337 |
'separator' => 'default', |
| 338 |
'size_units' => [ 'px' ], |
| 339 |
'selectors' => [ |
| 340 |
$widget->selectors['content_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 341 |
], |
| 342 |
], |
| 343 |
'show_title' => [ |
| 344 |
'label' => esc_html__( 'Show title', 'shopbuilder' ), |
| 345 |
'type' => 'choose', |
| 346 |
'options' => [ |
| 347 |
'block' => [ |
| 348 |
'title' => esc_html__( 'Show', 'shopbuilder' ), |
| 349 |
'icon' => 'eicon-check-circle', |
| 350 |
], |
| 351 |
'none' => [ |
| 352 |
'title' => esc_html__( 'Hide', 'shopbuilder' ), |
| 353 |
'icon' => 'eicon-editor-close', |
| 354 |
], |
| 355 |
], |
| 356 |
'default' => 'block', |
| 357 |
'selectors' => [ |
| 358 |
$widget->selectors['show_title'] => 'display: {{VALUE}} !important;', |
| 359 |
], |
| 360 |
], |
| 361 |
'tab_title_typography' => [ |
| 362 |
'mode' => 'group', |
| 363 |
'type' => 'typography', |
| 364 |
'separator' => 'before', |
| 365 |
'label' => esc_html__( 'Title Typography', 'shopbuilder' ), |
| 366 |
'condition' => [ |
| 367 |
'show_title' => 'block', |
| 368 |
], |
| 369 |
'selector' => $widget->selectors['tab_title_typography'], |
| 370 |
], |
| 371 |
'tab_title_gap' => [ |
| 372 |
'label' => esc_html__( 'Title Margin', 'shopbuilder' ), |
| 373 |
'type' => 'dimensions', |
| 374 |
'mode' => 'responsive', |
| 375 |
'size_units' => [ 'px' ], |
| 376 |
'condition' => [ |
| 377 |
'show_title' => 'block', |
| 378 |
], |
| 379 |
'selectors' => [ |
| 380 |
$widget->selectors['tab_title_gap'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 381 |
], |
| 382 |
], |
| 383 |
'tab_content_title_color' => [ |
| 384 |
'label' => esc_html__( 'Title Color', 'shopbuilder' ), |
| 385 |
'type' => 'color', |
| 386 |
|
| 387 |
'selectors' => [ |
| 388 |
$widget->selectors['tab_content_title_color'] => 'color: {{VALUE}}', |
| 389 |
], |
| 390 |
'condition' => [ |
| 391 |
'show_title' => 'block', |
| 392 |
], |
| 393 |
], |
| 394 |
'tab_content_style_end' => [ |
| 395 |
'mode' => 'section_end', |
| 396 |
], |
| 397 |
]; |
| 398 |
|
| 399 |
return $fields; |
| 400 |
} |
| 401 |
|
| 402 |
/** |
| 403 |
* Widget Field |
| 404 |
* |
| 405 |
* @return array |
| 406 |
*/ |
| 407 |
public static function additional_info( $widget ) { |
| 408 |
$fields = [ |
| 409 |
'additional_info_style' => [ |
| 410 |
'mode' => 'section_start', |
| 411 |
'tab' => 'style', |
| 412 |
'label' => esc_html__( 'Additional info', 'shopbuilder' ), |
| 413 |
'condition' => [ |
| 414 |
'additional_information' => 'yes', |
| 415 |
], |
| 416 |
], |
| 417 |
'additional_info_typography' => [ |
| 418 |
'mode' => 'group', |
| 419 |
'type' => 'typography', |
| 420 |
'label' => esc_html__( 'Typography', 'shopbuilder' ), |
| 421 |
'selector' => $widget->selectors['additional_info_typography'], |
| 422 |
], |
| 423 |
'attributes_gap' => [ |
| 424 |
'label' => esc_html__( 'Cell Padding', 'shopbuilder' ), |
| 425 |
'type' => 'dimensions', |
| 426 |
'mode' => 'responsive', |
| 427 |
'size_units' => [ 'px' ], |
| 428 |
'selectors' => [ |
| 429 |
$widget->selectors['attributes_gap'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 430 |
], |
| 431 |
], |
| 432 |
'additional_info_style_end' => [ |
| 433 |
'mode' => 'section_end', |
| 434 |
], |
| 435 |
]; |
| 436 |
|
| 437 |
return $fields; |
| 438 |
} |
| 439 |
} |
| 440 |
|