| 1 |
<?php |
| 2 |
/** |
| 3 |
* Elementor Style Fields Class. |
| 4 |
* |
| 5 |
* This class contains all the common fields for Style tab. |
| 6 |
* |
| 7 |
* @package RadiusTheme\SB |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace RadiusTheme\SB\Elementor\Widgets\Controls; |
| 11 |
|
| 12 |
use RadiusTheme\SB\Helpers\Fns; |
| 13 |
use RadiusTheme\SB\Elementor\Helper\ControlHelper; |
| 14 |
|
| 15 |
// Do not allow directly accessing this file. |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit( 'This script cannot be accessed directly.' ); |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Elementor Style Fields Class. |
| 22 |
*/ |
| 23 |
class StyleFields { |
| 24 |
/** |
| 25 |
* Tab name. |
| 26 |
* |
| 27 |
* @access private |
| 28 |
* @static |
| 29 |
* |
| 30 |
* @var string |
| 31 |
*/ |
| 32 |
private static $tab = 'style'; |
| 33 |
|
| 34 |
/** |
| 35 |
* Color Scheme Section |
| 36 |
* |
| 37 |
* @param object $obj Reference object. |
| 38 |
* |
| 39 |
* @return array |
| 40 |
*/ |
| 41 |
public static function color_scheme( $obj ): array { |
| 42 |
$css_selectors = $obj->selectors['color_scheme']; |
| 43 |
|
| 44 |
$fields['color_scheme_section'] = $obj->start_section( esc_html__( 'Color Scheme', 'shopbuilder' ), self::$tab ); |
| 45 |
|
| 46 |
$fields['primary_color'] = [ |
| 47 |
'type' => 'color', |
| 48 |
'label' => esc_html__( 'Primary Color', 'shopbuilder' ), |
| 49 |
'default' => '#0066ff', |
| 50 |
'selectors' => [ |
| 51 |
$css_selectors['primary_color'] => '--rtsb-color-primary: {{VALUE}}', |
| 52 |
], |
| 53 |
]; |
| 54 |
|
| 55 |
$fields['secondary_color'] = [ |
| 56 |
'type' => 'color', |
| 57 |
'label' => esc_html__( 'Secondary Color', 'shopbuilder' ), |
| 58 |
'default' => '#111', |
| 59 |
'selectors' => [ |
| 60 |
$css_selectors['secondary_color'] => '--rtsb-color-secondary: {{VALUE}}', |
| 61 |
], |
| 62 |
]; |
| 63 |
|
| 64 |
$fields['loader_color'] = [ |
| 65 |
'type' => 'color', |
| 66 |
'label' => esc_html__( 'Pre-Loader Color', 'shopbuilder' ), |
| 67 |
'default' => '#111', |
| 68 |
'selectors' => [ |
| 69 |
$css_selectors['secondary_color'] => '--rtsb-color-loader: {{VALUE}}', |
| 70 |
], |
| 71 |
]; |
| 72 |
|
| 73 |
$fields['color_scheme_section_end'] = $obj->end_section(); |
| 74 |
|
| 75 |
return apply_filters( 'rtsb/elements/elementor/color_style_control', $fields, $obj ); |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Layout Design Section |
| 80 |
* |
| 81 |
* @param object $obj Reference object. |
| 82 |
* |
| 83 |
* @return array |
| 84 |
*/ |
| 85 |
public static function layout_design( $obj ): array { |
| 86 |
$css_selectors = $obj->selectors['advanced']; |
| 87 |
|
| 88 |
$fields['layout_design_section'] = $obj->start_section( esc_html__( 'Layout Design', 'shopbuilder' ), self::$tab ); |
| 89 |
|
| 90 |
$fields['layout_design_note'] = $obj->el_heading( esc_html__( 'Layout', 'shopbuilder' ) ); |
| 91 |
|
| 92 |
$fields['grid_gap'] = [ |
| 93 |
'type' => 'slider', |
| 94 |
'mode' => 'responsive', |
| 95 |
'label' => esc_html__( 'Grid Gap / Spacing (px)', 'shopbuilder' ), |
| 96 |
'size_units' => [ 'px' ], |
| 97 |
'range' => [ |
| 98 |
'px' => [ |
| 99 |
'min' => 0, |
| 100 |
'max' => 100, |
| 101 |
'step' => 1, |
| 102 |
], |
| 103 |
], |
| 104 |
'default' => [ |
| 105 |
'unit' => 'px', |
| 106 |
'size' => 30, |
| 107 |
], |
| 108 |
'description' => esc_html__( 'Please select the grid gap in px.', 'shopbuilder' ), |
| 109 |
'selectors' => [ |
| 110 |
$obj->selectors['columns']['grid_gap']['padding'] => 'padding-left: calc({{SIZE}}{{UNIT}} / 2); padding-right: calc({{SIZE}}{{UNIT}} / 2);', |
| 111 |
$obj->selectors['columns']['grid_gap']['margin'] => 'margin-left: calc(-{{SIZE}}{{UNIT}} / 2); margin-right: calc(-{{SIZE}}{{UNIT}} / 2);', |
| 112 |
$obj->selectors['columns']['grid_gap']['slider_layout3'] => '--rtsb-slider-layout3-spacing: {{SIZE}}{{UNIT}};', |
| 113 |
$obj->selectors['columns']['grid_gap']['slider_layout9'] => '--rtsb-slider-layout9-spacing: {{SIZE}}{{UNIT}};', |
| 114 |
$css_selectors['element_margin'] => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 115 |
], |
| 116 |
]; |
| 117 |
|
| 118 |
$fields['grid_alignment'] = [ |
| 119 |
'mode' => 'responsive', |
| 120 |
'type' => 'choose', |
| 121 |
'label' => esc_html__( 'Alignment', 'shopbuilder' ), |
| 122 |
'options' => [ |
| 123 |
'left' => [ |
| 124 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 125 |
'icon' => 'eicon-text-align-left', |
| 126 |
], |
| 127 |
'center' => [ |
| 128 |
'title' => esc_html__( 'Center', 'shopbuilder' ), |
| 129 |
'icon' => 'eicon-text-align-center', |
| 130 |
], |
| 131 |
'right' => [ |
| 132 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 133 |
'icon' => 'eicon-text-align-right', |
| 134 |
], |
| 135 |
], |
| 136 |
'selectors' => [ |
| 137 |
$obj->selectors['columns']['grid_alignment']['text_align'] => 'text-align: {{VALUE}};', |
| 138 |
$obj->selectors['columns']['grid_alignment']['justify_content'] => 'justify-content: {{VALUE}};', |
| 139 |
], |
| 140 |
]; |
| 141 |
|
| 142 |
$fields['wrapper_color_note'] = $obj->el_heading( esc_html__( 'Colors & Shadow', 'shopbuilder' ), 'before' ); |
| 143 |
|
| 144 |
$fields['advanced_color_tabs'] = $obj->start_tab_group(); |
| 145 |
$fields['advanced_color_tab'] = $obj->start_tab( esc_html__( 'Normal', 'shopbuilder' ) ); |
| 146 |
|
| 147 |
$fields['content_bg_color'] = [ |
| 148 |
'type' => 'color', |
| 149 |
'label' => esc_html__( 'Content Background', 'shopbuilder' ), |
| 150 |
'selectors' => [ $css_selectors['content_bg_color'] => 'background-color: {{VALUE}};' ], |
| 151 |
]; |
| 152 |
|
| 153 |
$fields['element_bg_color'] = [ |
| 154 |
'type' => 'color', |
| 155 |
'label' => esc_html__( 'Element Background', 'shopbuilder' ), |
| 156 |
'selectors' => [ $css_selectors['element_bg_color'] => 'background-color: {{VALUE}};' ], |
| 157 |
]; |
| 158 |
|
| 159 |
$fields['rtsb_el_element_shadow'] = [ |
| 160 |
'type' => 'box-shadow', |
| 161 |
'mode' => 'group', |
| 162 |
'label' => esc_html__( 'Element Drop Shadow', 'shopbuilder' ), |
| 163 |
'selector' => $css_selectors['rtsb_el_element_shadow'], |
| 164 |
]; |
| 165 |
|
| 166 |
$fields['advanced_color_tab_end'] = $obj->end_tab(); |
| 167 |
$fields['advanced_hover_color_tab'] = $obj->start_tab( esc_html__( 'Hover', 'shopbuilder' ) ); |
| 168 |
|
| 169 |
$fields['content_hover_bg_color'] = [ |
| 170 |
'type' => 'color', |
| 171 |
'label' => esc_html__( 'Content Hover Background', 'shopbuilder' ), |
| 172 |
'selectors' => [ $css_selectors['content_hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 173 |
]; |
| 174 |
|
| 175 |
$fields['element_hover_bg_color'] = [ |
| 176 |
'type' => 'color', |
| 177 |
'label' => esc_html__( 'Element Hover Background', 'shopbuilder' ), |
| 178 |
'selectors' => [ $css_selectors['element_hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 179 |
]; |
| 180 |
|
| 181 |
$fields['rtsb_el_element_hover_shadow'] = [ |
| 182 |
'type' => 'box-shadow', |
| 183 |
'mode' => 'group', |
| 184 |
'label' => esc_html__( 'Element Hover Drop Shadow', 'shopbuilder' ), |
| 185 |
'selector' => $css_selectors['rtsb_el_element_hover_shadow'], |
| 186 |
]; |
| 187 |
|
| 188 |
$fields['advanced_hover_color_tab_end'] = $obj->end_tab(); |
| 189 |
$fields['advanced_color_tabs_end'] = $obj->end_tab_group(); |
| 190 |
|
| 191 |
$fields['wrapper_note'] = $obj->el_heading( esc_html__( 'Border', 'shopbuilder' ), 'before' ); |
| 192 |
|
| 193 |
$fields['rtsb_el_wrapper_border'] = [ |
| 194 |
'mode' => 'group', |
| 195 |
'type' => 'border', |
| 196 |
'label' => esc_html__( 'Wrapper Border', 'shopbuilder' ), |
| 197 |
'fields_options' => [ |
| 198 |
'border' => [ |
| 199 |
'label' => esc_html__( 'Wrapper Border Type', 'shopbuilder' ), |
| 200 |
'label_block' => true, |
| 201 |
], |
| 202 |
'color' => [ |
| 203 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 204 |
], |
| 205 |
], |
| 206 |
'selector' => $css_selectors['rtsb_el_wrapper_border'], |
| 207 |
]; |
| 208 |
|
| 209 |
$fields['wrapper_border_radius'] = [ |
| 210 |
'mode' => 'responsive', |
| 211 |
'type' => 'dimensions', |
| 212 |
'label' => esc_html__( 'Wrapper Border Radius', 'shopbuilder' ), |
| 213 |
'size_units' => [ 'px', '%', 'em' ], |
| 214 |
'selectors' => [ $css_selectors['wrapper_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 215 |
]; |
| 216 |
|
| 217 |
$fields['rtsb_el_element_border'] = [ |
| 218 |
'mode' => 'group', |
| 219 |
'type' => 'border', |
| 220 |
'label' => esc_html__( 'Element Border', 'shopbuilder' ), |
| 221 |
'fields_options' => [ |
| 222 |
'border' => [ |
| 223 |
'label' => esc_html__( 'Element Border Type', 'shopbuilder' ), |
| 224 |
'label_block' => true, |
| 225 |
], |
| 226 |
'color' => [ |
| 227 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 228 |
], |
| 229 |
], |
| 230 |
'separator' => 'before', |
| 231 |
'selector' => $css_selectors['rtsb_el_element_border'], |
| 232 |
]; |
| 233 |
|
| 234 |
$fields['element_border_hover_color'] = [ |
| 235 |
'type' => 'color', |
| 236 |
'label' => esc_html__( 'Hover Border Color', 'shopbuilder' ), |
| 237 |
'condition' => [ 'rtsb_el_element_border_border!' => [ '' ] ], |
| 238 |
'selectors' => [ $css_selectors['element_border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 239 |
]; |
| 240 |
|
| 241 |
$fields['element_border_radius'] = [ |
| 242 |
'mode' => 'responsive', |
| 243 |
'type' => 'dimensions', |
| 244 |
'label' => esc_html__( 'Element Border Radius', 'shopbuilder' ), |
| 245 |
'size_units' => [ 'px', '%', 'em' ], |
| 246 |
'selectors' => [ $css_selectors['element_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;' ], |
| 247 |
]; |
| 248 |
|
| 249 |
$fields['rtsb_el_content_border'] = [ |
| 250 |
'mode' => 'group', |
| 251 |
'type' => 'border', |
| 252 |
'label' => esc_html__( 'Content Border', 'shopbuilder' ), |
| 253 |
'fields_options' => [ |
| 254 |
'border' => [ |
| 255 |
'label' => esc_html__( 'Content Border Type', 'shopbuilder' ), |
| 256 |
'label_block' => true, |
| 257 |
], |
| 258 |
'color' => [ |
| 259 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 260 |
], |
| 261 |
], |
| 262 |
'separator' => 'before', |
| 263 |
'selector' => $css_selectors['rtsb_el_content_border'], |
| 264 |
]; |
| 265 |
|
| 266 |
$fields['content_border_hover_color'] = [ |
| 267 |
'type' => 'color', |
| 268 |
'label' => esc_html__( 'Hover Border Color', 'shopbuilder' ), |
| 269 |
'condition' => [ 'rtsb_el_content_border_border!' => [ '' ] ], |
| 270 |
'selectors' => [ $css_selectors['content_border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 271 |
]; |
| 272 |
|
| 273 |
$fields['content_border_radius'] = [ |
| 274 |
'mode' => 'responsive', |
| 275 |
'type' => 'dimensions', |
| 276 |
'label' => esc_html__( 'Content Border Radius', 'shopbuilder' ), |
| 277 |
'size_units' => [ 'px', '%', 'em' ], |
| 278 |
'selectors' => [ $css_selectors['content_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 279 |
]; |
| 280 |
|
| 281 |
$fields['advanced_spacing_note'] = $obj->el_heading( esc_html__( 'Spacing', 'shopbuilder' ), 'before' ); |
| 282 |
|
| 283 |
$fields['wrapper_padding'] = [ |
| 284 |
'mode' => 'responsive', |
| 285 |
'type' => 'dimensions', |
| 286 |
'label' => esc_html__( 'Wrapper Padding', 'shopbuilder' ), |
| 287 |
'size_units' => [ 'px', '%', 'em' ], |
| 288 |
'selectors' => [ $css_selectors['wrapper_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 289 |
]; |
| 290 |
|
| 291 |
$fields['element_padding'] = [ |
| 292 |
'mode' => 'responsive', |
| 293 |
'type' => 'dimensions', |
| 294 |
'label' => esc_html__( 'Element Padding', 'shopbuilder' ), |
| 295 |
'size_units' => [ 'px', '%', 'em' ], |
| 296 |
'selectors' => [ $css_selectors['element_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 297 |
]; |
| 298 |
|
| 299 |
$fields['content_padding'] = [ |
| 300 |
'mode' => 'responsive', |
| 301 |
'type' => 'dimensions', |
| 302 |
'label' => esc_html__( 'Content Padding', 'shopbuilder' ), |
| 303 |
'size_units' => [ 'px', '%', 'em' ], |
| 304 |
'selectors' => [ $css_selectors['content_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 305 |
]; |
| 306 |
|
| 307 |
$fields['layout_design_section_end'] = $obj->end_section(); |
| 308 |
|
| 309 |
return apply_filters( 'rtsb/elements/elementor/color_style_control', $fields, $obj ); |
| 310 |
} |
| 311 |
|
| 312 |
/** |
| 313 |
* Product Title Section |
| 314 |
* |
| 315 |
* @param object $obj Reference object. |
| 316 |
* |
| 317 |
* @return array |
| 318 |
*/ |
| 319 |
public static function product_title( $obj ): array { |
| 320 |
$css_selectors = $obj->selectors['product_title']; |
| 321 |
$title = esc_html__( 'Product Title', 'shopbuilder' ); |
| 322 |
$condition = [ |
| 323 |
'show_title' => [ 'yes' ], |
| 324 |
]; |
| 325 |
$selectors = self::title_selectors( $css_selectors ); |
| 326 |
|
| 327 |
$fields = ControlHelper::general_elementor_style( 'product_title', $title, $obj, $condition, $selectors ); |
| 328 |
|
| 329 |
return apply_filters( 'rtsb/elements/elementor/title_style_control', $fields, $obj ); |
| 330 |
} |
| 331 |
|
| 332 |
/** |
| 333 |
* Section Title Section |
| 334 |
* |
| 335 |
* @param object $obj Reference object. |
| 336 |
* |
| 337 |
* @return array |
| 338 |
*/ |
| 339 |
public static function section_title( $obj ): array { |
| 340 |
$css_selectors = $obj->selectors['section_title']; |
| 341 |
$title = esc_html__( 'Section Title', 'shopbuilder' ); |
| 342 |
$condition = [ |
| 343 |
'show_section_title' => [ 'yes' ], |
| 344 |
]; |
| 345 |
$selectors = self::title_selectors( $css_selectors ); |
| 346 |
|
| 347 |
$fields = ControlHelper::general_elementor_style( 'section_title', $title, $obj, $condition, $selectors ); |
| 348 |
|
| 349 |
return apply_filters( 'rtsb/elements/elementor/section_title_style_control', $fields, $obj ); |
| 350 |
} |
| 351 |
|
| 352 |
/** |
| 353 |
* Category Title Section |
| 354 |
* |
| 355 |
* @param object $obj Reference object. |
| 356 |
* |
| 357 |
* @return array |
| 358 |
*/ |
| 359 |
public static function cat_title( $obj ): array { |
| 360 |
$css_selectors = $obj->selectors['cat_title']; |
| 361 |
$title = esc_html__( 'Category Title', 'shopbuilder' ); |
| 362 |
$condition = [ |
| 363 |
'show_title' => [ 'yes' ], |
| 364 |
]; |
| 365 |
$selectors = self::title_selectors( $css_selectors ); |
| 366 |
|
| 367 |
$fields = ControlHelper::general_elementor_style( 'category_title', $title, $obj, $condition, $selectors ); |
| 368 |
|
| 369 |
return apply_filters( 'rtsb/elements/elementor/cat_title_style_control', $fields, $obj ); |
| 370 |
} |
| 371 |
|
| 372 |
/** |
| 373 |
* Short Description Section |
| 374 |
* |
| 375 |
* @param object $obj Reference object. |
| 376 |
* |
| 377 |
* @return array |
| 378 |
*/ |
| 379 |
public static function short_description( $obj ): array { |
| 380 |
$css_selectors = $obj->selectors['short_description']; |
| 381 |
$title = esc_html__( 'Short Description', 'shopbuilder' ); |
| 382 |
$condition = [ |
| 383 |
'show_short_desc' => [ 'yes' ], |
| 384 |
]; |
| 385 |
$selectors = self::excerpt_selectors( $css_selectors ); |
| 386 |
|
| 387 |
$fields = ControlHelper::general_elementor_style( 'short_description', $title, $obj, $condition, $selectors ); |
| 388 |
|
| 389 |
unset( |
| 390 |
$fields['short_description_color_tabs'], |
| 391 |
$fields['short_description_color_tab'], |
| 392 |
$fields['short_description_color_tab_end'], |
| 393 |
$fields['short_description_hover_color_tab'], |
| 394 |
$fields['short_description_hover_color'], |
| 395 |
$fields['short_description_hover_bg_color'], |
| 396 |
$fields['short_description_hover_color_tab_end'], |
| 397 |
$fields['short_description_color_tabs_end'], |
| 398 |
$fields['short_description_border_hover_color'] |
| 399 |
); |
| 400 |
|
| 401 |
return apply_filters( 'rtsb/elements/elementor/excerpt_style_control', $fields, $obj ); |
| 402 |
} |
| 403 |
|
| 404 |
/** |
| 405 |
* Category Description Section |
| 406 |
* |
| 407 |
* @param object $obj Reference object. |
| 408 |
* |
| 409 |
* @return array |
| 410 |
*/ |
| 411 |
public static function cat_description( $obj ): array { |
| 412 |
$css_selectors = $obj->selectors['cat_description']; |
| 413 |
$title = esc_html__( 'Category Description', 'shopbuilder' ); |
| 414 |
$condition = [ |
| 415 |
'show_short_desc' => [ 'yes' ], |
| 416 |
]; |
| 417 |
$selectors = self::excerpt_selectors( $css_selectors ); |
| 418 |
|
| 419 |
$fields = ControlHelper::general_elementor_style( 'category_description', $title, $obj, $condition, $selectors ); |
| 420 |
|
| 421 |
unset( |
| 422 |
$fields['category_description_color_tabs'], |
| 423 |
$fields['category_description_color_tab'], |
| 424 |
$fields['category_description_color_tab_end'], |
| 425 |
$fields['category_description_hover_color_tab'], |
| 426 |
$fields['category_description_hover_color'], |
| 427 |
$fields['category_description_hover_bg_color'], |
| 428 |
$fields['category_description_hover_color_tab_end'], |
| 429 |
$fields['category_description_color_tabs_end'], |
| 430 |
$fields['category_description_border_hover_color'] |
| 431 |
); |
| 432 |
|
| 433 |
return apply_filters( 'rtsb/elements/elementor/cat_excerpt_style_control', $fields, $obj ); |
| 434 |
} |
| 435 |
|
| 436 |
/** |
| 437 |
* Count Section |
| 438 |
* |
| 439 |
* @param object $obj Reference object. |
| 440 |
* |
| 441 |
* @return array |
| 442 |
*/ |
| 443 |
public static function count( $obj ): array { |
| 444 |
$css_selectors = $obj->selectors['count']; |
| 445 |
$title = esc_html__( 'Product Count', 'shopbuilder' ); |
| 446 |
$condition = [ |
| 447 |
'show_count' => [ 'yes' ], |
| 448 |
]; |
| 449 |
$selectors = [ |
| 450 |
'typography' => $css_selectors['typography'], |
| 451 |
'alignment' => [ $css_selectors['alignment'] => 'text-align: {{VALUE}};' ], |
| 452 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 453 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 454 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 455 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 456 |
'border' => $css_selectors['border'], |
| 457 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 458 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 459 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 460 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 461 |
]; |
| 462 |
|
| 463 |
$fields = ControlHelper::general_elementor_style( 'product_count', $title, $obj, $condition, $selectors ); |
| 464 |
|
| 465 |
$extra_controls = []; |
| 466 |
|
| 467 |
$extra_controls['product_count_radius'] = [ |
| 468 |
'mode' => 'responsive', |
| 469 |
'type' => 'dimensions', |
| 470 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 471 |
'size_units' => [ 'px', '%', 'em' ], |
| 472 |
'selectors' => $selectors['border_radius'], |
| 473 |
]; |
| 474 |
|
| 475 |
$fields = Fns::insert_controls( 'product_count_border_hover_color', $fields, $extra_controls, true ); |
| 476 |
|
| 477 |
return apply_filters( 'rtsb/elements/elementor/cat_count_style_control', $fields, $obj ); |
| 478 |
} |
| 479 |
|
| 480 |
/** |
| 481 |
* Product Price Section |
| 482 |
* |
| 483 |
* @param object $obj Reference object. |
| 484 |
* |
| 485 |
* @return array |
| 486 |
*/ |
| 487 |
public static function product_price( $obj ): array { |
| 488 |
$css_selectors = $obj->selectors['product_price']; |
| 489 |
$title = esc_html__( 'Product Price', 'shopbuilder' ); |
| 490 |
$condition = [ |
| 491 |
'show_price' => [ 'yes' ], |
| 492 |
]; |
| 493 |
$selectors = [ |
| 494 |
'typography' => $css_selectors['typography'], |
| 495 |
'sale_typography' => $css_selectors['sale_typography'], |
| 496 |
'regular_text_decoration' => $css_selectors['regular_text_decoration'], |
| 497 |
'sale_text_decoration' => $css_selectors['sale_text_decoration'], |
| 498 |
'alignment' => [ $css_selectors['alignment'] => 'text-align: {{VALUE}};' ], |
| 499 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 500 |
'regular_color' => [ $css_selectors['regular_color'] => 'color: {{VALUE}};' ], |
| 501 |
'crossed_regular_color' => [ $css_selectors['crossed_regular_color'] => 'color: {{VALUE}};' ], |
| 502 |
'border' => $css_selectors['border'], |
| 503 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 504 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 505 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 506 |
]; |
| 507 |
|
| 508 |
$fields = ControlHelper::general_elementor_style( 'product_price', $title, $obj, $condition, $selectors ); |
| 509 |
|
| 510 |
unset( |
| 511 |
$fields['product_price_color_tabs'], |
| 512 |
$fields['product_price_color_tab'], |
| 513 |
$fields['product_price_color_tab_end'], |
| 514 |
$fields['product_price_hover_color_tab'], |
| 515 |
$fields['product_price_hover_color'], |
| 516 |
$fields['product_price_hover_bg_color'], |
| 517 |
$fields['product_price_hover_color_tab_end'], |
| 518 |
$fields['product_price_color_tabs_end'], |
| 519 |
$fields['product_price_border_hover_color'] |
| 520 |
); |
| 521 |
|
| 522 |
$fields['rtsb_el_product_price_typography']['label'] = esc_html__( 'Regular Price Typography', 'shopbuilder' ); |
| 523 |
$fields['product_price_color']['label'] = esc_html__( 'Sale Price Color', 'shopbuilder' ); |
| 524 |
$fields['product_price_bg_color']['label'] = esc_html__( 'Regular Price Color', 'shopbuilder' ); |
| 525 |
$fields['product_price_bg_color']['selectors'] = $selectors['regular_color']; |
| 526 |
|
| 527 |
// Scope text-decoration narrowly so "Regular Price" decoration does not bleed onto |
| 528 |
// the sale price via the shared `.price-wrapper` parent (cascades visually across all |
| 529 |
// inline text). Other typography props keep the original wider selector. |
| 530 |
$fields['rtsb_el_product_price_typography']['fields_options'] = [ |
| 531 |
'text_decoration' => [ |
| 532 |
'selectors' => [ |
| 533 |
$selectors['regular_text_decoration'] => 'text-decoration: {{VALUE}};', |
| 534 |
], |
| 535 |
], |
| 536 |
]; |
| 537 |
|
| 538 |
$extra_controls['rtsb_el_product_sale_price_typography'] = [ |
| 539 |
'mode' => 'group', |
| 540 |
'type' => 'typography', |
| 541 |
'label' => esc_html__( 'Sale Price Typography', 'shopbuilder' ), |
| 542 |
'selector' => $selectors['sale_typography'], |
| 543 |
'fields_options' => [ |
| 544 |
'text_decoration' => [ |
| 545 |
'selectors' => [ |
| 546 |
$selectors['sale_text_decoration'] => 'text-decoration: {{VALUE}};', |
| 547 |
], |
| 548 |
], |
| 549 |
], |
| 550 |
]; |
| 551 |
|
| 552 |
$fields = Fns::insert_controls( 'rtsb_el_product_price_typography', $fields, $extra_controls ); |
| 553 |
|
| 554 |
$extra_controls['crossed_regular_color'] = [ |
| 555 |
'type' => 'color', |
| 556 |
'label' => esc_html__( 'Crossed Out Regular Price Color', 'shopbuilder' ), |
| 557 |
'selectors' => ! empty( $selectors['crossed_regular_color'] ) ? $selectors['crossed_regular_color'] : [], |
| 558 |
]; |
| 559 |
|
| 560 |
$fields = Fns::insert_controls( 'product_price_border_note', $fields, $extra_controls ); |
| 561 |
|
| 562 |
return apply_filters( 'rtsb/elements/elementor/price_style_control', $fields, $obj ); |
| 563 |
} |
| 564 |
|
| 565 |
/** |
| 566 |
* Product Rating Section |
| 567 |
* |
| 568 |
* @param object $obj Reference object. |
| 569 |
* |
| 570 |
* @return array |
| 571 |
*/ |
| 572 |
public static function product_rating( $obj ): array { |
| 573 |
$css_selectors = $obj->selectors['product_rating']; |
| 574 |
$title = esc_html__( 'Product Rating', 'shopbuilder' ); |
| 575 |
$condition = [ |
| 576 |
'show_rating' => [ 'yes' ], |
| 577 |
]; |
| 578 |
// Spacing control: preset1 spreads the five stars via letter-spacing on |
| 579 |
// `.star-rating`. preset2 has no `.star-rating` (it renders a single star |
| 580 |
// icon + rating number, optionally a count), so the same control spaces |
| 581 |
// those via `gap` on the flex rating wrappers — otherwise the setting |
| 582 |
// silently does nothing on preset2. |
| 583 |
$rating_spacing = [ $css_selectors['padding'] => 'letter-spacing: {{SIZE}}{{UNIT}};' ]; |
| 584 |
if ( ! empty( $css_selectors['spacing_preset2'] ) ) { |
| 585 |
$rating_spacing[ $css_selectors['spacing_preset2'] ] = 'gap: {{SIZE}}{{UNIT}};'; |
| 586 |
} |
| 587 |
|
| 588 |
$selectors = [ |
| 589 |
'typography' => [ $css_selectors['typography'] => 'font-size: {{SIZE}}{{UNIT}};' ], |
| 590 |
'alignment' => [ $css_selectors['alignment'] => 'justify-content: {{VALUE}};' ], |
| 591 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}} !important;' ], |
| 592 |
'bg_color' => [ $css_selectors['bg_color'] => 'color: {{VALUE}} !important;' ], |
| 593 |
'padding' => $rating_spacing, |
| 594 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 595 |
]; |
| 596 |
|
| 597 |
$fields = ControlHelper::general_elementor_style( 'product_rating', $title, $obj, $condition, $selectors ); |
| 598 |
|
| 599 |
unset( |
| 600 |
$fields['product_rating_color_tabs'], |
| 601 |
$fields['product_rating_color_tab'], |
| 602 |
$fields['product_rating_color_tab_end'], |
| 603 |
$fields['product_rating_hover_color_tab'], |
| 604 |
$fields['product_rating_hover_color'], |
| 605 |
$fields['product_rating_hover_bg_color'], |
| 606 |
$fields['product_rating_hover_color_tab_end'], |
| 607 |
$fields['product_rating_color_tabs_end'], |
| 608 |
$fields['product_rating_border_note'], |
| 609 |
$fields['rtsb_el_product_rating_border'], |
| 610 |
$fields['product_rating_border_hover_color'] |
| 611 |
); |
| 612 |
|
| 613 |
$fields['rtsb_el_product_rating_typography'] = [ |
| 614 |
'type' => 'slider', |
| 615 |
'mode' => 'responsive', |
| 616 |
'label' => esc_html__( 'Star Size', 'shopbuilder' ), |
| 617 |
'size_units' => [ 'px' ], |
| 618 |
'range' => [ |
| 619 |
'px' => [ |
| 620 |
'min' => 0, |
| 621 |
'max' => 100, |
| 622 |
], |
| 623 |
], |
| 624 |
'selectors' => $selectors['typography'], |
| 625 |
]; |
| 626 |
|
| 627 |
$fields['product_rating_bg_color']['label'] = esc_html__( 'Star Border Color', 'shopbuilder' ); |
| 628 |
|
| 629 |
$fields['product_rating_padding'] = [ |
| 630 |
'type' => 'slider', |
| 631 |
'mode' => 'responsive', |
| 632 |
'label' => esc_html__( 'Spacing', 'shopbuilder' ), |
| 633 |
'size_units' => [ 'px' ], |
| 634 |
'range' => [ |
| 635 |
'px' => [ |
| 636 |
'min' => -10, |
| 637 |
'max' => 50, |
| 638 |
], |
| 639 |
], |
| 640 |
'default' => [ |
| 641 |
'unit' => 'px', |
| 642 |
'size' => 3, |
| 643 |
], |
| 644 |
'selectors' => $selectors['padding'], |
| 645 |
]; |
| 646 |
|
| 647 |
return apply_filters( 'rtsb/elements/elementor/rating_style_control', $fields, $obj ); |
| 648 |
} |
| 649 |
|
| 650 |
/** |
| 651 |
* Product Badges Section |
| 652 |
* |
| 653 |
* @param object $obj Reference object. |
| 654 |
* |
| 655 |
* @return array |
| 656 |
*/ |
| 657 |
public static function product_badges( $obj ): array { |
| 658 |
$css_selectors = $obj->selectors['product_badges']; |
| 659 |
$title = esc_html__( 'Badges', 'shopbuilder' ); |
| 660 |
$condition = [ |
| 661 |
'show_badges' => [ 'yes' ], |
| 662 |
'layout!' => [ 'category-layout1', 'category-layout2' ], |
| 663 |
]; |
| 664 |
|
| 665 |
// Scope each position-offset selector to its own alignment/vertical class. |
| 666 |
// Elementor's frontend CSS generator emits a control's CSS based only on its |
| 667 |
// saved value and ignores the control `condition` (which governs panel |
| 668 |
// visibility only). Without this scoping, a horizontal/vertical offset set |
| 669 |
// under one alignment (e.g. Left/Right) keeps overriding the centering rules |
| 670 |
// after switching to Center/Middle, pushing the badge out of its |
| 671 |
// `overflow:hidden` image wrapper. Binding each offset to its matching |
| 672 |
// `badge-*` container class makes the offsets mutually exclusive, so a stale |
| 673 |
// value simply no longer matches once the alignment changes. |
| 674 |
$pos_x = $css_selectors['position_x']; |
| 675 |
$pos_y = $css_selectors['position_y']; |
| 676 |
$pos_x_left = str_replace( '.rtsb-elementor-container', '.rtsb-elementor-container.badge-left', $pos_x ); |
| 677 |
$pos_x_right = str_replace( '.rtsb-elementor-container', '.rtsb-elementor-container.badge-right', $pos_x ); |
| 678 |
$pos_x_center = str_replace( '.rtsb-elementor-container', '.rtsb-elementor-container.badge-center', $pos_x ); |
| 679 |
$pos_y_top = str_replace( '.rtsb-elementor-container', '.rtsb-elementor-container.badge-top', $pos_y ); |
| 680 |
$pos_y_bottom = str_replace( '.rtsb-elementor-container', '.rtsb-elementor-container.badge-bottom', $pos_y ); |
| 681 |
$pos_y_middle = str_replace( '.rtsb-elementor-container', '.rtsb-elementor-container.badge-middle', $pos_y ); |
| 682 |
|
| 683 |
$selectors = [ |
| 684 |
'typography' => $css_selectors['typography'], |
| 685 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 686 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 687 |
'border_color' => [ $css_selectors['border_color'] => 'border-color: {{VALUE}};' ], |
| 688 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 689 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 690 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 691 |
'position_x' => [ $pos_x_left => 'left: {{SIZE}}{{UNIT}};' ], |
| 692 |
'position_x_right' => [ $pos_x_right => 'right: {{SIZE}}{{UNIT}}; left: auto;' ], |
| 693 |
// Center/Middle keep the framework centering (`left/top:50%` + the |
| 694 |
// `translate(-50%)` from `_cp-badges.scss`). Offsetting via `calc(50% + …)` |
| 695 |
// composes with that transform instead of fighting it, so a positive value |
| 696 |
// nudges right/down and a negative value nudges left/up from dead-center. |
| 697 |
'position_x_center' => [ $pos_x_center => 'left: calc(50% + {{SIZE}}{{UNIT}});' ], |
| 698 |
'position_y' => [ $pos_y_top => 'top: {{SIZE}}{{UNIT}};' ], |
| 699 |
'position_y_bottom' => [ $pos_y_bottom => 'bottom: {{SIZE}}{{UNIT}}; top:auto;' ], |
| 700 |
'position_y_middle' => [ $pos_y_middle => 'top: calc(50% + {{SIZE}}{{UNIT}});' ], |
| 701 |
]; |
| 702 |
|
| 703 |
$fields = ControlHelper::general_elementor_style( 'badges', $title, $obj, $condition, $selectors ); |
| 704 |
|
| 705 |
unset( |
| 706 |
$fields['badges_alignment'], |
| 707 |
$fields['badges_color_tabs'], |
| 708 |
$fields['badges_color_tab'], |
| 709 |
$fields['badges_color_tab_end'], |
| 710 |
$fields['badges_hover_color_tab'], |
| 711 |
$fields['badges_hover_color'], |
| 712 |
$fields['badges_hover_bg_color'], |
| 713 |
$fields['badges_hover_color_tab_end'], |
| 714 |
$fields['badges_color_tabs_end'], |
| 715 |
$fields['badges_border_note'], |
| 716 |
$fields['rtsb_el_badges_border'], |
| 717 |
$fields['badges_border_hover_color'] |
| 718 |
); |
| 719 |
|
| 720 |
$fields['badges_alignment']['label'] = esc_html__( 'Horizontal Alignment', 'shopbuilder' ); |
| 721 |
|
| 722 |
$extra_controls = []; |
| 723 |
|
| 724 |
$extra_controls['badges_alignment'] = [ |
| 725 |
'type' => 'select2', |
| 726 |
'label' => esc_html__( 'Horizontal Alignment', 'shopbuilder' ), |
| 727 |
'options' => [ |
| 728 |
'left' => esc_html__( 'Left', 'shopbuilder' ), |
| 729 |
'center' => esc_html__( 'Center', 'shopbuilder' ), |
| 730 |
'right' => esc_html__( 'Right', 'shopbuilder' ), |
| 731 |
], |
| 732 |
'label_block' => true, |
| 733 |
'default' => 'left', |
| 734 |
]; |
| 735 |
|
| 736 |
$extra_controls['badges_position'] = [ |
| 737 |
'type' => 'select2', |
| 738 |
'label' => esc_html__( 'Vertical Alignment', 'shopbuilder' ), |
| 739 |
'options' => [ |
| 740 |
'top' => esc_html__( 'Top', 'shopbuilder' ), |
| 741 |
'middle' => esc_html__( 'Middle', 'shopbuilder' ), |
| 742 |
'bottom' => esc_html__( 'Bottom', 'shopbuilder' ), |
| 743 |
], |
| 744 |
'label_block' => true, |
| 745 |
'default' => 'top', |
| 746 |
]; |
| 747 |
|
| 748 |
$extra_controls['badge_x_position'] = [ |
| 749 |
'type' => 'slider', |
| 750 |
'mode' => 'responsive', |
| 751 |
'label' => esc_html__( 'Position Offset (Horizontal)', 'shopbuilder' ), |
| 752 |
'size_units' => [ 'px', '%' ], |
| 753 |
'range' => [ |
| 754 |
'px' => [ |
| 755 |
'min' => 0, |
| 756 |
'max' => 300, |
| 757 |
'step' => 1, |
| 758 |
], |
| 759 |
'%' => [ |
| 760 |
'min' => 0, |
| 761 |
'max' => 100, |
| 762 |
'step' => 1, |
| 763 |
], |
| 764 |
], |
| 765 |
'condition' => [ |
| 766 |
'badges_alignment' => 'left', |
| 767 |
'badges_alignment!' => 'center', |
| 768 |
], |
| 769 |
'selectors' => $selectors['position_x'], |
| 770 |
]; |
| 771 |
|
| 772 |
$extra_controls['badge_x_position_right'] = [ |
| 773 |
'type' => 'slider', |
| 774 |
'mode' => 'responsive', |
| 775 |
'label' => esc_html__( 'Position Offset (Horizontal)', 'shopbuilder' ), |
| 776 |
'size_units' => [ 'px', '%' ], |
| 777 |
'range' => [ |
| 778 |
'px' => [ |
| 779 |
'min' => 0, |
| 780 |
'max' => 300, |
| 781 |
'step' => 1, |
| 782 |
], |
| 783 |
'%' => [ |
| 784 |
'min' => 0, |
| 785 |
'max' => 100, |
| 786 |
'step' => 1, |
| 787 |
], |
| 788 |
], |
| 789 |
'condition' => [ 'badges_alignment' => 'right' ], |
| 790 |
'selectors' => $selectors['position_x_right'], |
| 791 |
]; |
| 792 |
|
| 793 |
$extra_controls['badge_x_position_center'] = [ |
| 794 |
'type' => 'slider', |
| 795 |
'mode' => 'responsive', |
| 796 |
'label' => esc_html__( 'Position Offset (Horizontal)', 'shopbuilder' ), |
| 797 |
'description' => esc_html__( 'Nudge the centered badge horizontally. Positive moves right, negative moves left.', 'shopbuilder' ), |
| 798 |
'size_units' => [ 'px', '%' ], |
| 799 |
'range' => [ |
| 800 |
'px' => [ |
| 801 |
'min' => -300, |
| 802 |
'max' => 300, |
| 803 |
'step' => 1, |
| 804 |
], |
| 805 |
'%' => [ |
| 806 |
'min' => -100, |
| 807 |
'max' => 100, |
| 808 |
'step' => 1, |
| 809 |
], |
| 810 |
], |
| 811 |
'condition' => [ 'badges_alignment' => 'center' ], |
| 812 |
'selectors' => $selectors['position_x_center'], |
| 813 |
]; |
| 814 |
|
| 815 |
$extra_controls['badge_y_position'] = [ |
| 816 |
'type' => 'slider', |
| 817 |
'mode' => 'responsive', |
| 818 |
'label' => esc_html__( 'Position Offset (Vertical)', 'shopbuilder' ), |
| 819 |
'size_units' => [ 'px', '%' ], |
| 820 |
'range' => [ |
| 821 |
'px' => [ |
| 822 |
'min' => 0, |
| 823 |
'max' => 300, |
| 824 |
'step' => 1, |
| 825 |
], |
| 826 |
'%' => [ |
| 827 |
'min' => 0, |
| 828 |
'max' => 100, |
| 829 |
'step' => 1, |
| 830 |
], |
| 831 |
], |
| 832 |
'condition' => [ |
| 833 |
'badges_position' => 'top', |
| 834 |
'badges_position!' => 'center', |
| 835 |
], |
| 836 |
'selectors' => $selectors['position_y'], |
| 837 |
]; |
| 838 |
|
| 839 |
$extra_controls['badge_y_position_bottom'] = [ |
| 840 |
'type' => 'slider', |
| 841 |
'mode' => 'responsive', |
| 842 |
'label' => esc_html__( 'Position Offset (Vertical)', 'shopbuilder' ), |
| 843 |
'size_units' => [ 'px', '%' ], |
| 844 |
'range' => [ |
| 845 |
'px' => [ |
| 846 |
'min' => 0, |
| 847 |
'max' => 300, |
| 848 |
'step' => 1, |
| 849 |
], |
| 850 |
'%' => [ |
| 851 |
'min' => 0, |
| 852 |
'max' => 100, |
| 853 |
'step' => 1, |
| 854 |
], |
| 855 |
], |
| 856 |
'condition' => [ |
| 857 |
'badges_position' => 'bottom', |
| 858 |
'badges_position!' => 'center', |
| 859 |
], |
| 860 |
'selectors' => $selectors['position_y_bottom'], |
| 861 |
]; |
| 862 |
|
| 863 |
$extra_controls['badge_y_position_middle'] = [ |
| 864 |
'type' => 'slider', |
| 865 |
'mode' => 'responsive', |
| 866 |
'label' => esc_html__( 'Position Offset (Vertical)', 'shopbuilder' ), |
| 867 |
'description' => esc_html__( 'Nudge the middle-aligned badge vertically. Positive moves down, negative moves up.', 'shopbuilder' ), |
| 868 |
'size_units' => [ 'px', '%' ], |
| 869 |
'range' => [ |
| 870 |
'px' => [ |
| 871 |
'min' => -300, |
| 872 |
'max' => 300, |
| 873 |
'step' => 1, |
| 874 |
], |
| 875 |
'%' => [ |
| 876 |
'min' => -100, |
| 877 |
'max' => 100, |
| 878 |
'step' => 1, |
| 879 |
], |
| 880 |
], |
| 881 |
'condition' => [ 'badges_position' => 'middle' ], |
| 882 |
'selectors' => $selectors['position_y_middle'], |
| 883 |
]; |
| 884 |
|
| 885 |
$fields = Fns::insert_controls( 'badges_color_note', $fields, $extra_controls ); |
| 886 |
|
| 887 |
$extra_controls['badges_border_color'] = [ |
| 888 |
'type' => 'color', |
| 889 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 890 |
'selectors' => ! empty( $selectors['border_color'] ) ? $selectors['border_color'] : [], |
| 891 |
// Only the outline presets (preset3/preset4 → `.rtsb-tag-outline`) carry a |
| 892 |
// border; the fill presets (preset1/preset2 → `.rtsb-tag-fill`) have none, |
| 893 |
// so a border colour is a no-op there. Show this control only where it works. |
| 894 |
'condition' => [ |
| 895 |
'custom_badge_preset' => [ 'preset3', 'preset4' ], |
| 896 |
], |
| 897 |
]; |
| 898 |
|
| 899 |
$extra_controls['badges_border_radius'] = [ |
| 900 |
'mode' => 'responsive', |
| 901 |
'type' => 'dimensions', |
| 902 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 903 |
'size_units' => [ 'px', '%', 'em' ], |
| 904 |
'selectors' => $selectors['border_radius'], |
| 905 |
]; |
| 906 |
|
| 907 |
$fields = Fns::insert_controls( 'badges_bg_color', $fields, $extra_controls, true ); |
| 908 |
|
| 909 |
return apply_filters( 'rtsb/elements/elementor/badges_style_control', $fields, $obj ); |
| 910 |
} |
| 911 |
|
| 912 |
/** |
| 913 |
* Product Categories Section |
| 914 |
* |
| 915 |
* @param object $obj Reference object. |
| 916 |
* |
| 917 |
* @return array |
| 918 |
*/ |
| 919 |
public static function product_categories( $obj ): array { |
| 920 |
$css_selectors = $obj->selectors['product_categories']; |
| 921 |
$title = esc_html__( 'Product Categories', 'shopbuilder' ); |
| 922 |
$condition = [ |
| 923 |
'show_categories' => [ 'yes' ], |
| 924 |
]; |
| 925 |
$selectors = [ |
| 926 |
'typography' => $css_selectors['typography'], |
| 927 |
'alignment' => [ $css_selectors['alignment'] => 'justify-content: {{VALUE}};' ], |
| 928 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 929 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 930 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 931 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 932 |
'border' => $css_selectors['typography'], |
| 933 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 934 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 935 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 936 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 937 |
'wrapper_margin' => [ $css_selectors['wrapper_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 938 |
]; |
| 939 |
|
| 940 |
$fields = ControlHelper::general_elementor_style( 'product_categories', $title, $obj, $condition, $selectors ); |
| 941 |
|
| 942 |
// Force text-decoration with !important so the widget setting beats the framework-wide |
| 943 |
// `.rtsb-elementor-container a { text-decoration: none !important; }` reset. That reset |
| 944 |
// is intentionally kept to shield category links from theme link styles. |
| 945 |
$fields['rtsb_el_product_categories_typography']['fields_options'] = [ |
| 946 |
'text_decoration' => [ |
| 947 |
'selectors' => [ |
| 948 |
$css_selectors['typography'] => 'text-decoration: {{VALUE}} !important;', |
| 949 |
], |
| 950 |
], |
| 951 |
]; |
| 952 |
|
| 953 |
$fields['product_categories_alignment']['options'] = [ |
| 954 |
'flex-start' => [ |
| 955 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 956 |
'icon' => 'eicon-text-align-left', |
| 957 |
], |
| 958 |
'center' => [ |
| 959 |
'title' => esc_html__( 'Center', 'shopbuilder' ), |
| 960 |
'icon' => 'eicon-text-align-center', |
| 961 |
], |
| 962 |
'flex-end' => [ |
| 963 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 964 |
'icon' => 'eicon-text-align-right', |
| 965 |
], |
| 966 |
]; |
| 967 |
|
| 968 |
$extra_controls = []; |
| 969 |
|
| 970 |
$extra_controls['product_categories_radius'] = [ |
| 971 |
'mode' => 'responsive', |
| 972 |
'type' => 'dimensions', |
| 973 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 974 |
'size_units' => [ 'px', '%', 'em' ], |
| 975 |
'selectors' => $selectors['border_radius'], |
| 976 |
]; |
| 977 |
|
| 978 |
$fields = Fns::insert_controls( 'product_categories_border_hover_color', $fields, $extra_controls, true ); |
| 979 |
|
| 980 |
$extra_controls['product_categories_wrapper_margin'] = [ |
| 981 |
'mode' => 'responsive', |
| 982 |
'type' => 'dimensions', |
| 983 |
'label' => esc_html__( 'Wrapper Margin', 'shopbuilder' ), |
| 984 |
'size_units' => [ 'px', '%', 'em' ], |
| 985 |
'selectors' => $selectors['wrapper_margin'], |
| 986 |
]; |
| 987 |
|
| 988 |
$fields = Fns::insert_controls( 'product_categories_margin', $fields, $extra_controls, true ); |
| 989 |
|
| 990 |
return apply_filters( 'rtsb/elements/elementor/categories_style_control', $fields, $obj ); |
| 991 |
} |
| 992 |
|
| 993 |
/** |
| 994 |
* Product Categories Section |
| 995 |
* |
| 996 |
* @param object $obj Reference object. |
| 997 |
* |
| 998 |
* @return array |
| 999 |
*/ |
| 1000 |
public static function product_brands( $obj ): array { |
| 1001 |
$css_selectors = $obj->selectors['product_brands']; |
| 1002 |
$title = esc_html__( 'Product Brands', 'shopbuilder' ); |
| 1003 |
$condition = [ |
| 1004 |
'show_brands' => [ 'yes' ], |
| 1005 |
]; |
| 1006 |
$selectors = [ |
| 1007 |
'typography' => $css_selectors['typography'], |
| 1008 |
'alignment' => [ $css_selectors['alignment'] => 'justify-content: {{VALUE}};' ], |
| 1009 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 1010 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 1011 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 1012 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 1013 |
'border' => $css_selectors['typography'], |
| 1014 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 1015 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1016 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1017 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1018 |
'wrapper_margin' => [ $css_selectors['wrapper_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1019 |
]; |
| 1020 |
|
| 1021 |
$fields = ControlHelper::general_elementor_style( 'product_brands', $title, $obj, $condition, $selectors ); |
| 1022 |
|
| 1023 |
// Force text-decoration with !important so the widget setting beats the framework-wide |
| 1024 |
// `.rtsb-elementor-container a { text-decoration: none !important; }` reset. That reset |
| 1025 |
// is intentionally kept to shield brand markup from theme link styles. |
| 1026 |
$fields['rtsb_el_product_brands_typography']['fields_options'] = [ |
| 1027 |
'text_decoration' => [ |
| 1028 |
'selectors' => [ |
| 1029 |
$css_selectors['typography'] => 'text-decoration: {{VALUE}} !important;', |
| 1030 |
], |
| 1031 |
], |
| 1032 |
]; |
| 1033 |
|
| 1034 |
$fields['product_brands_alignment']['options'] = [ |
| 1035 |
'flex-start' => [ |
| 1036 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 1037 |
'icon' => 'eicon-text-align-left', |
| 1038 |
], |
| 1039 |
'center' => [ |
| 1040 |
'title' => esc_html__( 'Center', 'shopbuilder' ), |
| 1041 |
'icon' => 'eicon-text-align-center', |
| 1042 |
], |
| 1043 |
'flex-end' => [ |
| 1044 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 1045 |
'icon' => 'eicon-text-align-right', |
| 1046 |
], |
| 1047 |
]; |
| 1048 |
|
| 1049 |
$extra_controls = []; |
| 1050 |
|
| 1051 |
$extra_controls['product_brands_radius'] = [ |
| 1052 |
'mode' => 'responsive', |
| 1053 |
'type' => 'dimensions', |
| 1054 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 1055 |
'size_units' => [ 'px', '%', 'em' ], |
| 1056 |
'selectors' => $selectors['border_radius'], |
| 1057 |
]; |
| 1058 |
|
| 1059 |
$fields = Fns::insert_controls( 'product_brands_border_hover_color', $fields, $extra_controls, true ); |
| 1060 |
|
| 1061 |
$extra_controls['product_brands_wrapper_margin'] = [ |
| 1062 |
'mode' => 'responsive', |
| 1063 |
'type' => 'dimensions', |
| 1064 |
'label' => esc_html__( 'Wrapper Margin', 'shopbuilder' ), |
| 1065 |
'size_units' => [ 'px', '%', 'em' ], |
| 1066 |
'selectors' => $selectors['wrapper_margin'], |
| 1067 |
]; |
| 1068 |
|
| 1069 |
$fields = Fns::insert_controls( 'product_brands_margin', $fields, $extra_controls, true ); |
| 1070 |
|
| 1071 |
return apply_filters( 'rtsb/elements/elementor/brands_style_control', $fields, $obj ); |
| 1072 |
} |
| 1073 |
|
| 1074 |
/** |
| 1075 |
* Image Section |
| 1076 |
* |
| 1077 |
* @param object $obj Reference object. |
| 1078 |
* @param array $conditions Conditions. |
| 1079 |
* |
| 1080 |
* @return array |
| 1081 |
*/ |
| 1082 |
public static function image( $obj, $conditions ): array { |
| 1083 |
$css_selectors = $obj->selectors['image']; |
| 1084 |
$title = esc_html__( 'Image Styles', 'shopbuilder' ); |
| 1085 |
$selectors = [ |
| 1086 |
'overlay' => $css_selectors['overlay'], |
| 1087 |
'hover_overlay' => $css_selectors['hover_overlay'], |
| 1088 |
'border' => $css_selectors['border'], |
| 1089 |
'width' => [ $css_selectors['width'] => 'width: {{SIZE}}{{UNIT}};' ], |
| 1090 |
'img_bg_color' => [ $css_selectors['img_bg_color'] => 'background-color: {{VALUE}};' ], |
| 1091 |
'img_wrapper_bg_color' => [ $css_selectors['img_wrapper_bg_color'] => 'background-color: {{VALUE}};' ], |
| 1092 |
'max_width' => [ $css_selectors['max_width'] => 'max-width: {{SIZE}}{{UNIT}};' ], |
| 1093 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1094 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 1095 |
]; |
| 1096 |
|
| 1097 |
$fields = ControlHelper::general_elementor_style( 'image_styles', $title, $obj, [], $selectors, $conditions ); |
| 1098 |
|
| 1099 |
unset( |
| 1100 |
$fields['rtsb_el_image_styles_typography'], |
| 1101 |
$fields['image_styles_alignment'], |
| 1102 |
$fields['image_styles_color_tabs'], |
| 1103 |
$fields['image_styles_color_tab'], |
| 1104 |
$fields['image_styles_color_note'], |
| 1105 |
$fields['image_styles_color'], |
| 1106 |
$fields['image_styles_bg_color'], |
| 1107 |
$fields['image_styles_color_tab_end'], |
| 1108 |
$fields['image_styles_hover_color_tab'], |
| 1109 |
$fields['image_styles_hover_color'], |
| 1110 |
$fields['image_styles_hover_bg_color'], |
| 1111 |
$fields['image_styles_hover_color_tab_end'], |
| 1112 |
$fields['image_styles_color_tabs_end'], |
| 1113 |
$fields['image_styles_border_hover_color'], |
| 1114 |
$fields['image_styles_padding'] |
| 1115 |
); |
| 1116 |
|
| 1117 |
$fields['image_styles_typo_note']['raw'] = sprintf( |
| 1118 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 1119 |
esc_html__( 'Overlay', 'shopbuilder' ) |
| 1120 |
); |
| 1121 |
$fields['image_styles_border_note']['separator'] = 'before-short'; |
| 1122 |
$fields['image_styles_typo_note']['separator'] = 'before'; |
| 1123 |
$fields['image_styles_typo_note']['condition'] = [ 'show_overlay' => [ 'yes' ] ]; |
| 1124 |
|
| 1125 |
$extra_controls = []; |
| 1126 |
|
| 1127 |
$extra_controls['image_styles_dimension_note'] = $obj->el_heading( esc_html__( 'Dimension', 'shopbuilder' ) ); |
| 1128 |
|
| 1129 |
$extra_controls['image_styles_width'] = [ |
| 1130 |
'type' => 'slider', |
| 1131 |
'label' => esc_html__( 'Image Width', 'shopbuilder' ), |
| 1132 |
'size_units' => [ '%', 'px' ], |
| 1133 |
'range' => [ |
| 1134 |
'%' => [ |
| 1135 |
'min' => 0, |
| 1136 |
'max' => 100, |
| 1137 |
'step' => 1, |
| 1138 |
], |
| 1139 |
'px' => [ |
| 1140 |
'min' => 0, |
| 1141 |
'max' => 1200, |
| 1142 |
'step' => 1, |
| 1143 |
], |
| 1144 |
], |
| 1145 |
'selectors' => $selectors['width'], |
| 1146 |
]; |
| 1147 |
|
| 1148 |
$extra_controls['image_styles_max_width'] = [ |
| 1149 |
'type' => 'slider', |
| 1150 |
'label' => esc_html__( 'Image Max-Width', 'shopbuilder' ), |
| 1151 |
'size_units' => [ '%', 'px' ], |
| 1152 |
'range' => [ |
| 1153 |
'%' => [ |
| 1154 |
'min' => 0, |
| 1155 |
'max' => 100, |
| 1156 |
'step' => 1, |
| 1157 |
], |
| 1158 |
'px' => [ |
| 1159 |
'min' => 0, |
| 1160 |
'max' => 1200, |
| 1161 |
'step' => 1, |
| 1162 |
], |
| 1163 |
|
| 1164 |
], |
| 1165 |
'selectors' => $selectors['max_width'], |
| 1166 |
]; |
| 1167 |
|
| 1168 |
$extra_controls['image_styles_color_note'] = $obj->el_heading( esc_html__( 'Colors', 'shopbuilder' ), 'before' ); |
| 1169 |
|
| 1170 |
$extra_controls['image_styles_color'] = [ |
| 1171 |
'type' => 'color', |
| 1172 |
'label' => esc_html__( 'Image Background Color', 'shopbuilder' ), |
| 1173 |
'selectors' => $selectors['img_bg_color'], |
| 1174 |
]; |
| 1175 |
|
| 1176 |
$extra_controls['image_wrapper_styles_color'] = [ |
| 1177 |
'type' => 'color', |
| 1178 |
'label' => esc_html__( 'Wrapper Background Color', 'shopbuilder' ), |
| 1179 |
'selectors' => $selectors['img_wrapper_bg_color'], |
| 1180 |
]; |
| 1181 |
|
| 1182 |
$fields = Fns::insert_controls( 'image_styles_typo_note', $fields, $extra_controls ); |
| 1183 |
|
| 1184 |
$extra_controls['rtsb_el_image_styles_overlay'] = [ |
| 1185 |
'mode' => 'group', |
| 1186 |
'type' => 'background', |
| 1187 |
'label' => esc_html__( 'Image Overlay', 'shopbuilder' ), |
| 1188 |
'types' => [ 'classic', 'gradient' ], |
| 1189 |
'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 1190 |
'fields_options' => [ |
| 1191 |
'background' => [ |
| 1192 |
'label' => esc_html__( 'Overlay Background Type', 'shopbuilder' ), |
| 1193 |
], |
| 1194 |
'color' => [ |
| 1195 |
'label' => 'Background', |
| 1196 |
], |
| 1197 |
'color_b' => [ |
| 1198 |
'label' => 'Background 2', |
| 1199 |
], |
| 1200 |
], |
| 1201 |
'selector' => $selectors['overlay'], |
| 1202 |
'condition' => [ |
| 1203 |
'show_overlay' => [ 'yes' ], |
| 1204 |
], |
| 1205 |
]; |
| 1206 |
|
| 1207 |
$extra_controls['rtsb_el_image_styles_hover_overlay'] = [ |
| 1208 |
'mode' => 'group', |
| 1209 |
'type' => 'background', |
| 1210 |
'label' => esc_html__( 'Hover Image Overlay', 'shopbuilder' ), |
| 1211 |
'types' => [ 'classic', 'gradient' ], |
| 1212 |
'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 1213 |
'fields_options' => [ |
| 1214 |
'background' => [ |
| 1215 |
'label' => esc_html__( 'Hover Overlay Background Type', 'shopbuilder' ), |
| 1216 |
], |
| 1217 |
'color' => [ |
| 1218 |
'label' => 'Hover Background', |
| 1219 |
], |
| 1220 |
'color_b' => [ |
| 1221 |
'label' => 'Hover Background 2', |
| 1222 |
], |
| 1223 |
], |
| 1224 |
'selector' => $selectors['hover_overlay'], |
| 1225 |
'condition' => [ |
| 1226 |
'show_overlay' => [ 'yes' ], |
| 1227 |
], |
| 1228 |
]; |
| 1229 |
|
| 1230 |
$fields = Fns::insert_controls( 'image_styles_typo_note', $fields, $extra_controls, true ); |
| 1231 |
|
| 1232 |
$extra_controls['image_styles_radius'] = [ |
| 1233 |
'mode' => 'responsive', |
| 1234 |
'type' => 'dimensions', |
| 1235 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 1236 |
'size_units' => [ 'px', '%', 'em' ], |
| 1237 |
'selectors' => $selectors['border_radius'], |
| 1238 |
]; |
| 1239 |
|
| 1240 |
$fields = Fns::insert_controls( 'rtsb_el_image_styles_border', $fields, $extra_controls, true ); |
| 1241 |
|
| 1242 |
return apply_filters( 'rtsb/elements/elementor/image_style_control', $fields, $obj ); |
| 1243 |
} |
| 1244 |
|
| 1245 |
/** |
| 1246 |
* Product Image Section |
| 1247 |
* |
| 1248 |
* @param object $obj Reference object. |
| 1249 |
* |
| 1250 |
* @return array |
| 1251 |
*/ |
| 1252 |
public static function product_image( $obj ): array { |
| 1253 |
$conditions = [ |
| 1254 |
'relation' => 'and', |
| 1255 |
'terms' => [ |
| 1256 |
[ |
| 1257 |
'relation' => 'or', |
| 1258 |
'terms' => [ |
| 1259 |
[ |
| 1260 |
'name' => 'show_featured_image', |
| 1261 |
'operator' => '==', |
| 1262 |
'value' => 'yes', |
| 1263 |
], |
| 1264 |
], |
| 1265 |
], |
| 1266 |
], |
| 1267 |
]; |
| 1268 |
|
| 1269 |
return self::image( $obj, $conditions ); |
| 1270 |
} |
| 1271 |
|
| 1272 |
/** |
| 1273 |
* Category Image Section |
| 1274 |
* |
| 1275 |
* @param object $obj Reference object. |
| 1276 |
* |
| 1277 |
* @return array |
| 1278 |
*/ |
| 1279 |
public static function category_image( $obj ): array { |
| 1280 |
$conditions = [ |
| 1281 |
'relation' => 'and', |
| 1282 |
'terms' => [ |
| 1283 |
[ |
| 1284 |
'relation' => 'or', |
| 1285 |
'terms' => [ |
| 1286 |
[ |
| 1287 |
'name' => 'show_cat_image', |
| 1288 |
'operator' => '==', |
| 1289 |
'value' => 'yes', |
| 1290 |
], |
| 1291 |
[ |
| 1292 |
'name' => 'show_custom_image', |
| 1293 |
'operator' => '==', |
| 1294 |
'value' => 'yes', |
| 1295 |
], |
| 1296 |
], |
| 1297 |
], |
| 1298 |
], |
| 1299 |
]; |
| 1300 |
|
| 1301 |
return self::image( $obj, $conditions ); |
| 1302 |
} |
| 1303 |
|
| 1304 |
/** |
| 1305 |
* Pagination Section |
| 1306 |
* |
| 1307 |
* @param object $obj Reference object. |
| 1308 |
* |
| 1309 |
* @return array |
| 1310 |
*/ |
| 1311 |
public static function pagination( $obj ): array { |
| 1312 |
$css_selectors = $obj->selectors['pagination']; |
| 1313 |
$title = esc_html__( 'Pagination Buttons', 'shopbuilder' ); |
| 1314 |
$condition = [ 'show_pagination' => [ 'yes' ] ]; |
| 1315 |
$selectors = [ |
| 1316 |
'typography' => $css_selectors['typography'], |
| 1317 |
'alignment' => [ $css_selectors['alignment'] => 'justify-content: {{VALUE}};' ], |
| 1318 |
'width' => [ $css_selectors['width'] => 'width: {{SIZE}}{{UNIT}};' ], |
| 1319 |
'height' => [ $css_selectors['height'] => 'height: {{SIZE}}{{UNIT}};' ], |
| 1320 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 1321 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 1322 |
'active_color' => [ $css_selectors['active_color'] => 'color: {{VALUE}};' ], |
| 1323 |
'active_bg_color' => [ $css_selectors['active_bg_color'] => 'background-color: {{VALUE}};' ], |
| 1324 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 1325 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 1326 |
'border' => $css_selectors['border'], |
| 1327 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 1328 |
'border_active_color' => [ $css_selectors['border_active_color'] => 'border-color: {{VALUE}};' ], |
| 1329 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1330 |
'spacing' => [ $css_selectors['spacing'] => 'gap: {{SIZE}}{{UNIT}};' ], |
| 1331 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1332 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1333 |
]; |
| 1334 |
|
| 1335 |
$fields = ControlHelper::general_elementor_style( 'pagination_buttons', $title, $obj, $condition, $selectors ); |
| 1336 |
|
| 1337 |
// Force text-decoration with !important so the typography setting beats the framework-wide |
| 1338 |
// `.rtsb-elementor-container a { text-decoration: none !important; }` reset. Without this the |
| 1339 |
// reset suppresses the decoration on the inactive page links (`li a`) while the active page |
| 1340 |
// (`li span`, not a link) still shows it — producing inconsistent pagination styling. |
| 1341 |
$fields['rtsb_el_pagination_buttons_typography']['fields_options'] = [ |
| 1342 |
'text_decoration' => [ |
| 1343 |
'selectors' => [ |
| 1344 |
$css_selectors['typography'] => 'text-decoration: {{VALUE}} !important;', |
| 1345 |
], |
| 1346 |
], |
| 1347 |
]; |
| 1348 |
|
| 1349 |
unset( $fields['pagination_buttons_padding'] ); |
| 1350 |
|
| 1351 |
$fields['pagination_buttons_alignment']['options'] = [ |
| 1352 |
'flex-start' => [ |
| 1353 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 1354 |
'icon' => 'eicon-text-align-left', |
| 1355 |
], |
| 1356 |
'center' => [ |
| 1357 |
'title' => esc_html__( 'Center', 'shopbuilder' ), |
| 1358 |
'icon' => 'eicon-text-align-center', |
| 1359 |
], |
| 1360 |
'flex-end' => [ |
| 1361 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 1362 |
'icon' => 'eicon-text-align-right', |
| 1363 |
], |
| 1364 |
]; |
| 1365 |
|
| 1366 |
$extra_controls = []; |
| 1367 |
|
| 1368 |
$extra_controls['pagination_buttons_width'] = [ |
| 1369 |
'type' => 'slider', |
| 1370 |
'mode' => 'responsive', |
| 1371 |
'label' => esc_html__( 'Width', 'shopbuilder' ), |
| 1372 |
'size_units' => [ 'px' ], |
| 1373 |
'range' => [ |
| 1374 |
'px' => [ |
| 1375 |
'min' => 0, |
| 1376 |
'max' => 100, |
| 1377 |
], |
| 1378 |
], |
| 1379 |
'selectors' => $selectors['width'], |
| 1380 |
]; |
| 1381 |
|
| 1382 |
$extra_controls['pagination_buttons_height'] = [ |
| 1383 |
'type' => 'slider', |
| 1384 |
'mode' => 'responsive', |
| 1385 |
'label' => esc_html__( 'Height', 'shopbuilder' ), |
| 1386 |
'size_units' => [ 'px' ], |
| 1387 |
'range' => [ |
| 1388 |
'px' => [ |
| 1389 |
'min' => 0, |
| 1390 |
'max' => 100, |
| 1391 |
], |
| 1392 |
], |
| 1393 |
'selectors' => $selectors['height'], |
| 1394 |
]; |
| 1395 |
|
| 1396 |
$fields = Fns::insert_controls( 'pagination_buttons_color_note', $fields, $extra_controls ); |
| 1397 |
|
| 1398 |
$extra_controls['pagination_buttons_active_color'] = [ |
| 1399 |
'type' => 'color', |
| 1400 |
'label' => esc_html__( 'Active Color', 'shopbuilder' ), |
| 1401 |
'selectors' => $selectors['active_color'], |
| 1402 |
'condition' => [ |
| 1403 |
'pagination_type!' => 'load_more', |
| 1404 |
], |
| 1405 |
]; |
| 1406 |
|
| 1407 |
$extra_controls['pagination_buttons_active_bg_color'] = [ |
| 1408 |
'type' => 'color', |
| 1409 |
'label' => esc_html__( 'Active Background Color', 'shopbuilder' ), |
| 1410 |
'selectors' => $selectors['active_bg_color'], |
| 1411 |
'condition' => [ |
| 1412 |
'pagination_type!' => 'load_more', |
| 1413 |
], |
| 1414 |
]; |
| 1415 |
|
| 1416 |
$fields = Fns::insert_controls( 'pagination_buttons_bg_color', $fields, $extra_controls, true ); |
| 1417 |
|
| 1418 |
$extra_controls['pagination_buttons_active_border_color'] = [ |
| 1419 |
'type' => 'color', |
| 1420 |
'label' => esc_html__( 'Active Border Color', 'shopbuilder' ), |
| 1421 |
'condition' => [ 'rtsb_el_pagination_buttons_border_border!' => [ '' ] ], |
| 1422 |
'selectors' => $selectors['border_active_color'], |
| 1423 |
]; |
| 1424 |
|
| 1425 |
$extra_controls['pagination_buttons_radius'] = [ |
| 1426 |
'mode' => 'responsive', |
| 1427 |
'type' => 'dimensions', |
| 1428 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 1429 |
'size_units' => [ 'px', '%', 'em' ], |
| 1430 |
'selectors' => $selectors['border_radius'], |
| 1431 |
]; |
| 1432 |
|
| 1433 |
$fields = Fns::insert_controls( 'pagination_buttons_border_hover_color', $fields, $extra_controls, true ); |
| 1434 |
|
| 1435 |
$extra_controls['pagination_buttons_spacing'] = [ |
| 1436 |
'type' => 'slider', |
| 1437 |
'mode' => 'responsive', |
| 1438 |
'label' => esc_html__( 'Spacing', 'shopbuilder' ), |
| 1439 |
'size_units' => [ 'px' ], |
| 1440 |
'range' => [ |
| 1441 |
'px' => [ |
| 1442 |
'min' => 0, |
| 1443 |
'max' => 100, |
| 1444 |
], |
| 1445 |
], |
| 1446 |
'selectors' => $selectors['spacing'], |
| 1447 |
'condition' => [ |
| 1448 |
'pagination_type!' => 'load_more', |
| 1449 |
], |
| 1450 |
]; |
| 1451 |
|
| 1452 |
$extra_controls['pagination_buttons_padding'] = [ |
| 1453 |
'mode' => 'responsive', |
| 1454 |
'type' => 'dimensions', |
| 1455 |
'label' => esc_html__( 'Padding', 'shopbuilder' ), |
| 1456 |
'size_units' => [ 'px', '%', 'em' ], |
| 1457 |
'selectors' => ! empty( $selectors['padding'] ) ? $selectors['padding'] : [], |
| 1458 |
'condition' => [ |
| 1459 |
'pagination_type' => 'load_more', |
| 1460 |
], |
| 1461 |
]; |
| 1462 |
|
| 1463 |
$fields = Fns::insert_controls( 'pagination_buttons_spacing_note', $fields, $extra_controls, true ); |
| 1464 |
|
| 1465 |
return apply_filters( 'rtsb/elements/elementor/pagination_style_control', $fields, $obj ); |
| 1466 |
} |
| 1467 |
|
| 1468 |
/** |
| 1469 |
* Product Add to Cart Section |
| 1470 |
* |
| 1471 |
* @param object $obj Reference object. |
| 1472 |
* |
| 1473 |
* @return array |
| 1474 |
*/ |
| 1475 |
public static function product_add_to_cart( $obj ): array { |
| 1476 |
$css_selectors = $obj->selectors['product_add_to_cart']; |
| 1477 |
$title = esc_html__( 'Add to Cart Button', 'shopbuilder' ); |
| 1478 |
$condition = [ |
| 1479 |
'show_add_to_cart' => [ 'yes' ], |
| 1480 |
]; |
| 1481 |
$selectors = [ |
| 1482 |
'typography' => $css_selectors['typography'], |
| 1483 |
'icon_size' => [ |
| 1484 |
$css_selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}};', |
| 1485 |
$css_selectors['icon_size']['width'] => 'height: {{SIZE}}{{UNIT}};', |
| 1486 |
], |
| 1487 |
'cart_width' => [ $css_selectors['cart_width'] => 'width: {{SIZE}}{{UNIT}} !important;' ], |
| 1488 |
'cart_height' => [ $css_selectors['cart_height'] => 'height: {{SIZE}}{{UNIT}} !important;' ], |
| 1489 |
'color' => [ self::scope_selectors_to_label( $css_selectors['color'] ) => 'color: {{VALUE}};' ], |
| 1490 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 1491 |
'icon_color' => [ $css_selectors['icon_color'] => 'color: {{VALUE}};' ], |
| 1492 |
'hover_color' => [ self::scope_selectors_to_label( $css_selectors['hover_color'] ) => 'color: {{VALUE}};' ], |
| 1493 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 1494 |
'hover_icon_color' => [ $css_selectors['hover_icon_color'] => 'color: {{VALUE}};' ], |
| 1495 |
'border' => $css_selectors['border'], |
| 1496 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 1497 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 1498 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 1499 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1500 |
]; |
| 1501 |
|
| 1502 |
$fields = ControlHelper::general_elementor_style( 'add_to_cart_button', $title, $obj, $condition, $selectors ); |
| 1503 |
|
| 1504 |
// Relabel the generic "Color" / "Hover Color" controls to "Text Color" / "Hover Text Color" |
| 1505 |
// so they read distinctly from the "Background Color" controls. |
| 1506 |
$fields['add_to_cart_button_color']['label'] = esc_html__( 'Text Color', 'shopbuilder' ); |
| 1507 |
$fields['add_to_cart_button_hover_color']['label'] = esc_html__( 'Hover Text Color', 'shopbuilder' ); |
| 1508 |
|
| 1509 |
// Force text-decoration with !important, scoped to the label span (`.text`) on EACH selector. |
| 1510 |
// The !important beats the framework-wide `.rtsb-elementor-container a { text-decoration: none |
| 1511 |
// !important; }` reset (the button is an `<a>`, so otherwise the setting silently does nothing). |
| 1512 |
// Scoping to `.text` keeps the decoration line off the sibling `.icon` — a text-decoration set on |
| 1513 |
// the button ancestor is painted across all its inline descendants, underlining the icon too. |
| 1514 |
// scope_selectors_to_label() walks the multi-selector list (free base + pro per-layout parts); |
| 1515 |
// plain concatenation would only reach the last selector and leave the others on the button. |
| 1516 |
$fields['rtsb_el_add_to_cart_button_typography']['fields_options'] = [ |
| 1517 |
'text_decoration' => [ |
| 1518 |
'selectors' => [ |
| 1519 |
self::scope_selectors_to_label( $css_selectors['typography'] ) => 'text-decoration: {{VALUE}} !important;', |
| 1520 |
], |
| 1521 |
], |
| 1522 |
]; |
| 1523 |
|
| 1524 |
$fields['add_to_cart_button_alignment'] = [ |
| 1525 |
'type' => 'slider', |
| 1526 |
'mode' => 'responsive', |
| 1527 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 1528 |
'size_units' => [ 'px' ], |
| 1529 |
'range' => [ |
| 1530 |
'px' => [ |
| 1531 |
'min' => 0, |
| 1532 |
'max' => 100, |
| 1533 |
], |
| 1534 |
], |
| 1535 |
'condition' => [ |
| 1536 |
'show_cart_icon' => [ 'yes' ], |
| 1537 |
], |
| 1538 |
'selectors' => $selectors['icon_size'], |
| 1539 |
]; |
| 1540 |
|
| 1541 |
$extra_controls = []; |
| 1542 |
|
| 1543 |
$extra_controls['cart_icon_alignment'] = [ |
| 1544 |
'type' => 'choose', |
| 1545 |
'label' => esc_html__( 'Icon Alignment', 'shopbuilder' ), |
| 1546 |
'options' => [ |
| 1547 |
'left' => [ |
| 1548 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 1549 |
'icon' => 'eicon-arrow-left', |
| 1550 |
], |
| 1551 |
'right' => [ |
| 1552 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 1553 |
'icon' => 'eicon-arrow-right', |
| 1554 |
], |
| 1555 |
], |
| 1556 |
'default' => 'left', |
| 1557 |
'toggle' => true, |
| 1558 |
'condition' => [ |
| 1559 |
'show_cart_text' => [ 'yes' ], |
| 1560 |
'show_cart_icon' => [ 'yes' ], |
| 1561 |
], |
| 1562 |
]; |
| 1563 |
|
| 1564 |
$extra_controls['cart_width'] = [ |
| 1565 |
'type' => 'slider', |
| 1566 |
'mode' => 'responsive', |
| 1567 |
'label' => esc_html__( 'Width', 'shopbuilder' ), |
| 1568 |
'size_units' => [ 'px', '%' ], |
| 1569 |
'range' => [ |
| 1570 |
'px' => [ |
| 1571 |
'min' => 0, |
| 1572 |
'max' => 1000, |
| 1573 |
], |
| 1574 |
], |
| 1575 |
'selectors' => $selectors['cart_width'], |
| 1576 |
]; |
| 1577 |
|
| 1578 |
$extra_controls['cart_height'] = [ |
| 1579 |
'type' => 'slider', |
| 1580 |
'mode' => 'responsive', |
| 1581 |
'label' => esc_html__( 'height', 'shopbuilder' ), |
| 1582 |
'size_units' => [ 'px', '%' ], |
| 1583 |
'range' => [ |
| 1584 |
'px' => [ |
| 1585 |
'min' => 0, |
| 1586 |
'max' => 1000, |
| 1587 |
], |
| 1588 |
], |
| 1589 |
'selectors' => $selectors['cart_height'], |
| 1590 |
]; |
| 1591 |
|
| 1592 |
$fields = Fns::insert_controls( 'add_to_cart_button_alignment', $fields, $extra_controls, true ); |
| 1593 |
|
| 1594 |
$extra_controls['add_to_cart_button_icon_color'] = [ |
| 1595 |
'type' => 'color', |
| 1596 |
'label' => esc_html__( 'Icon Color', 'shopbuilder' ), |
| 1597 |
'selectors' => $selectors['icon_color'], |
| 1598 |
]; |
| 1599 |
|
| 1600 |
$fields = Fns::insert_controls( 'add_to_cart_button_bg_color', $fields, $extra_controls, true ); |
| 1601 |
|
| 1602 |
$extra_controls['add_to_cart_button_hover_icon_color'] = [ |
| 1603 |
'type' => 'color', |
| 1604 |
'label' => esc_html__( 'Hover Icon Color', 'shopbuilder' ), |
| 1605 |
'selectors' => $selectors['hover_icon_color'], |
| 1606 |
]; |
| 1607 |
|
| 1608 |
$fields = Fns::insert_controls( 'add_to_cart_button_hover_bg_color', $fields, $extra_controls, true ); |
| 1609 |
|
| 1610 |
$extra_controls['add_to_cart_button_radius'] = [ |
| 1611 |
'mode' => 'responsive', |
| 1612 |
'type' => 'dimensions', |
| 1613 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 1614 |
'size_units' => [ 'px', '%', 'em' ], |
| 1615 |
'selectors' => $selectors['border_radius'], |
| 1616 |
]; |
| 1617 |
|
| 1618 |
$fields = Fns::insert_controls( 'add_to_cart_button_border_hover_color', $fields, $extra_controls, true ); |
| 1619 |
|
| 1620 |
return apply_filters( 'rtsb/elements/elementor/add_to_cart_style_control', $fields, $obj ); |
| 1621 |
} |
| 1622 |
|
| 1623 |
/** |
| 1624 |
* Action Buttons Section. |
| 1625 |
* |
| 1626 |
* Shared style controls that apply to every action button (Add to Cart, Wishlist, |
| 1627 |
* Compare, Quick View) instead of a single button type. The Icon Spacing control |
| 1628 |
* uses flex `gap` on `.rtsb-action-btn.has-text`, so it adapts to both icon-left |
| 1629 |
* and icon-right layouts and only affects buttons that display text. |
| 1630 |
* |
| 1631 |
* @param object $obj Reference object. |
| 1632 |
* |
| 1633 |
* @return array |
| 1634 |
*/ |
| 1635 |
public static function action_buttons( $obj ): array { |
| 1636 |
$css_selectors = $obj->selectors['action_buttons']; |
| 1637 |
|
| 1638 |
$fields = []; |
| 1639 |
|
| 1640 |
$fields['action_buttons_style_section'] = $obj->start_section( |
| 1641 |
esc_html__( 'Action Buttons', 'shopbuilder' ), |
| 1642 |
'style' |
| 1643 |
); |
| 1644 |
|
| 1645 |
$fields['action_buttons_icon_gap'] = [ |
| 1646 |
'type' => 'slider', |
| 1647 |
'mode' => 'responsive', |
| 1648 |
'label' => esc_html__( 'Icon/Text Spacing', 'shopbuilder' ), |
| 1649 |
'description' => esc_html__( 'Gap between the icon and text on action buttons. Applies whenever button text is shown.', 'shopbuilder' ), |
| 1650 |
'size_units' => [ 'px' ], |
| 1651 |
'range' => [ |
| 1652 |
'px' => [ |
| 1653 |
'min' => 0, |
| 1654 |
'max' => 100, |
| 1655 |
], |
| 1656 |
], |
| 1657 |
'default' => [ |
| 1658 |
'unit' => 'px', |
| 1659 |
'size' => 8, |
| 1660 |
], |
| 1661 |
'selectors' => [ |
| 1662 |
$css_selectors['icon_gap'] => 'gap: {{SIZE}}{{UNIT}} !important;', |
| 1663 |
], |
| 1664 |
]; |
| 1665 |
|
| 1666 |
$fields['action_buttons_style_section_end'] = $obj->end_section(); |
| 1667 |
|
| 1668 |
return apply_filters( 'rtsb/elements/elementor/action_buttons_style_control', $fields, $obj ); |
| 1669 |
} |
| 1670 |
|
| 1671 |
/** |
| 1672 |
* Append the label-span suffix (` .text`) to every selector in a comma-separated list. |
| 1673 |
* |
| 1674 |
* The Add-to-Cart selector maps are multi-selector lists — the free base plus the per-layout |
| 1675 |
* selectors that pro appends (grid/slider/list layouts). Text-only styling (Text Color, Hover |
| 1676 |
* Text Color, Text Decoration) must target the label span on EACH selector so it never lands on |
| 1677 |
* the button ancestor, where `color` would inherit into the sibling `.icon` and a `text-decoration` |
| 1678 |
* line would be painted across it. Plain string concatenation would only reach the last selector. |
| 1679 |
* |
| 1680 |
* @param string $selector_list Comma-separated CSS selector list of button selectors. |
| 1681 |
* |
| 1682 |
* @return string Comma-separated list with ` .text` appended to each selector. |
| 1683 |
*/ |
| 1684 |
private static function scope_selectors_to_label( $selector_list ): string { |
| 1685 |
$selectors = array_filter( array_map( 'trim', explode( ',', (string) $selector_list ) ) ); |
| 1686 |
$selectors = array_map( |
| 1687 |
static function ( $selector ) { |
| 1688 |
return $selector . ' .text'; |
| 1689 |
}, |
| 1690 |
$selectors |
| 1691 |
); |
| 1692 |
|
| 1693 |
return implode( ', ', $selectors ); |
| 1694 |
} |
| 1695 |
|
| 1696 |
/** |
| 1697 |
* Product Compare Section |
| 1698 |
* |
| 1699 |
* @param object $obj Reference object. |
| 1700 |
* |
| 1701 |
* @return array |
| 1702 |
*/ |
| 1703 |
public static function product_compare( $obj ): array { |
| 1704 |
$css_selectors = $obj->selectors['product_compare']; |
| 1705 |
$title = esc_html__( 'Compare Button', 'shopbuilder' ); |
| 1706 |
$condition = [ |
| 1707 |
'show_compare' => [ 'yes' ], |
| 1708 |
]; |
| 1709 |
$selectors = self::action_btn_selectors( $css_selectors ); |
| 1710 |
|
| 1711 |
$fields = ControlHelper::general_elementor_style( 'compare_button', $title, $obj, $condition, $selectors ); |
| 1712 |
|
| 1713 |
unset( $fields['compare_button_alignment'] ); |
| 1714 |
|
| 1715 |
$fields['rtsb_el_compare_button_typography'] = [ |
| 1716 |
'type' => 'slider', |
| 1717 |
'mode' => 'responsive', |
| 1718 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 1719 |
'size_units' => [ 'px' ], |
| 1720 |
'range' => [ |
| 1721 |
'px' => [ |
| 1722 |
'min' => 0, |
| 1723 |
'max' => 100, |
| 1724 |
], |
| 1725 |
], |
| 1726 |
'condition' => [ |
| 1727 |
'show_cart_icon' => [ 'yes' ], |
| 1728 |
], |
| 1729 |
'selectors' => $selectors['icon_size'], |
| 1730 |
]; |
| 1731 |
|
| 1732 |
$extra_controls = []; |
| 1733 |
|
| 1734 |
$extra_controls['compare_width'] = [ |
| 1735 |
'type' => 'slider', |
| 1736 |
'mode' => 'responsive', |
| 1737 |
'label' => esc_html__( 'Min Width', 'shopbuilder' ), |
| 1738 |
'size_units' => [ 'px' ], |
| 1739 |
'range' => [ |
| 1740 |
'px' => [ |
| 1741 |
'min' => 0, |
| 1742 |
'max' => 1000, |
| 1743 |
], |
| 1744 |
], |
| 1745 |
'selectors' => $selectors['width'], |
| 1746 |
]; |
| 1747 |
|
| 1748 |
$extra_controls['compare_height'] = [ |
| 1749 |
'type' => 'slider', |
| 1750 |
'mode' => 'responsive', |
| 1751 |
'label' => esc_html__( 'height', 'shopbuilder' ), |
| 1752 |
'size_units' => [ 'px' ], |
| 1753 |
'range' => [ |
| 1754 |
'px' => [ |
| 1755 |
'min' => 0, |
| 1756 |
'max' => 100, |
| 1757 |
], |
| 1758 |
], |
| 1759 |
'selectors' => $selectors['height'], |
| 1760 |
]; |
| 1761 |
|
| 1762 |
$fields = Fns::insert_controls( 'compare_button_color_note', $fields, $extra_controls ); |
| 1763 |
|
| 1764 |
$extra_controls['compare_button_radius'] = [ |
| 1765 |
'mode' => 'responsive', |
| 1766 |
'type' => 'dimensions', |
| 1767 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 1768 |
'size_units' => [ 'px', '%', 'em' ], |
| 1769 |
'selectors' => $selectors['border_radius'], |
| 1770 |
]; |
| 1771 |
|
| 1772 |
$fields = Fns::insert_controls( 'compare_button_border_hover_color', $fields, $extra_controls, true ); |
| 1773 |
|
| 1774 |
return apply_filters( 'rtsb/elements/elementor/compare_style_control', $fields, $obj ); |
| 1775 |
} |
| 1776 |
|
| 1777 |
/** |
| 1778 |
* Product Wishlist Section |
| 1779 |
* |
| 1780 |
* @param object $obj Reference object. |
| 1781 |
* |
| 1782 |
* @return array |
| 1783 |
*/ |
| 1784 |
public static function product_wishlist( $obj ): array { |
| 1785 |
$css_selectors = $obj->selectors['product_wishlist']; |
| 1786 |
$title = esc_html__( 'Wishlist Button', 'shopbuilder' ); |
| 1787 |
$condition = [ |
| 1788 |
'show_wishlist' => [ 'yes' ], |
| 1789 |
]; |
| 1790 |
$selectors = self::action_btn_selectors( $css_selectors ); |
| 1791 |
|
| 1792 |
$fields = ControlHelper::general_elementor_style( 'wishlist_button', $title, $obj, $condition, $selectors ); |
| 1793 |
|
| 1794 |
unset( $fields['wishlist_button_alignment'] ); |
| 1795 |
|
| 1796 |
$fields['rtsb_el_wishlist_button_typography'] = [ |
| 1797 |
'type' => 'slider', |
| 1798 |
'mode' => 'responsive', |
| 1799 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 1800 |
'size_units' => [ 'px' ], |
| 1801 |
'range' => [ |
| 1802 |
'px' => [ |
| 1803 |
'min' => 0, |
| 1804 |
'max' => 100, |
| 1805 |
], |
| 1806 |
], |
| 1807 |
'condition' => [ |
| 1808 |
'show_cart_icon' => [ 'yes' ], |
| 1809 |
], |
| 1810 |
'selectors' => $selectors['icon_size'], |
| 1811 |
]; |
| 1812 |
|
| 1813 |
$extra_controls = []; |
| 1814 |
|
| 1815 |
$extra_controls['wishlist_width'] = [ |
| 1816 |
'type' => 'slider', |
| 1817 |
'mode' => 'responsive', |
| 1818 |
'label' => esc_html__( 'Min Width', 'shopbuilder' ), |
| 1819 |
'size_units' => [ 'px' ], |
| 1820 |
'range' => [ |
| 1821 |
'px' => [ |
| 1822 |
'min' => 0, |
| 1823 |
'max' => 1000, |
| 1824 |
], |
| 1825 |
], |
| 1826 |
'selectors' => $selectors['width'], |
| 1827 |
]; |
| 1828 |
$extra_controls['wishlist_height'] = [ |
| 1829 |
'type' => 'slider', |
| 1830 |
'mode' => 'responsive', |
| 1831 |
'label' => esc_html__( 'height', 'shopbuilder' ), |
| 1832 |
'size_units' => [ 'px' ], |
| 1833 |
'range' => [ |
| 1834 |
'px' => [ |
| 1835 |
'min' => 0, |
| 1836 |
'max' => 100, |
| 1837 |
], |
| 1838 |
], |
| 1839 |
'selectors' => $selectors['height'], |
| 1840 |
]; |
| 1841 |
|
| 1842 |
$fields = Fns::insert_controls( 'wishlist_button_color_note', $fields, $extra_controls ); |
| 1843 |
|
| 1844 |
$extra_controls['wishlist_button_radius'] = [ |
| 1845 |
'mode' => 'responsive', |
| 1846 |
'type' => 'dimensions', |
| 1847 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 1848 |
'size_units' => [ 'px', '%', 'em' ], |
| 1849 |
'selectors' => $selectors['border_radius'], |
| 1850 |
]; |
| 1851 |
|
| 1852 |
$fields = Fns::insert_controls( 'wishlist_button_border_hover_color', $fields, $extra_controls, true ); |
| 1853 |
|
| 1854 |
return apply_filters( 'rtsb/elements/elementor/wishlist_style_control', $fields, $obj ); |
| 1855 |
} |
| 1856 |
|
| 1857 |
/** |
| 1858 |
* Product Quick View Section |
| 1859 |
* |
| 1860 |
* @param object $obj Reference object. |
| 1861 |
* |
| 1862 |
* @return array |
| 1863 |
*/ |
| 1864 |
public static function product_quick_view( $obj ): array { |
| 1865 |
$css_selectors = $obj->selectors['product_quick_view']; |
| 1866 |
$title = esc_html__( 'Quick View Button', 'shopbuilder' ); |
| 1867 |
$condition = [ |
| 1868 |
'show_quick_view' => [ 'yes' ], |
| 1869 |
]; |
| 1870 |
$selectors = self::action_btn_selectors( $css_selectors ); |
| 1871 |
|
| 1872 |
$fields = ControlHelper::general_elementor_style( 'quick_view_button', $title, $obj, $condition, $selectors ); |
| 1873 |
|
| 1874 |
unset( $fields['quick_view_button_alignment'] ); |
| 1875 |
|
| 1876 |
$fields['rtsb_el_quick_view_button_typography'] = [ |
| 1877 |
'type' => 'slider', |
| 1878 |
'mode' => 'responsive', |
| 1879 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 1880 |
'size_units' => [ 'px' ], |
| 1881 |
'range' => [ |
| 1882 |
'px' => [ |
| 1883 |
'min' => 0, |
| 1884 |
'max' => 100, |
| 1885 |
], |
| 1886 |
], |
| 1887 |
'condition' => [ |
| 1888 |
'show_cart_icon' => [ 'yes' ], |
| 1889 |
], |
| 1890 |
'selectors' => $selectors['icon_size'], |
| 1891 |
]; |
| 1892 |
|
| 1893 |
$extra_controls = []; |
| 1894 |
|
| 1895 |
$extra_controls['quick_view_width'] = [ |
| 1896 |
'type' => 'slider', |
| 1897 |
'mode' => 'responsive', |
| 1898 |
'label' => esc_html__( 'Min Width', 'shopbuilder' ), |
| 1899 |
'size_units' => [ 'px' ], |
| 1900 |
'range' => [ |
| 1901 |
'px' => [ |
| 1902 |
'min' => 0, |
| 1903 |
'max' => 1000, |
| 1904 |
], |
| 1905 |
], |
| 1906 |
'selectors' => $selectors['width'], |
| 1907 |
]; |
| 1908 |
|
| 1909 |
$extra_controls['quick_view_height'] = [ |
| 1910 |
'type' => 'slider', |
| 1911 |
'mode' => 'responsive', |
| 1912 |
'label' => esc_html__( 'height', 'shopbuilder' ), |
| 1913 |
'size_units' => [ 'px' ], |
| 1914 |
'range' => [ |
| 1915 |
'px' => [ |
| 1916 |
'min' => 0, |
| 1917 |
'max' => 100, |
| 1918 |
], |
| 1919 |
], |
| 1920 |
'selectors' => $selectors['height'], |
| 1921 |
]; |
| 1922 |
|
| 1923 |
$fields = Fns::insert_controls( 'quick_view_button_color_note', $fields, $extra_controls ); |
| 1924 |
|
| 1925 |
$extra_controls['quick_view_button_radius'] = [ |
| 1926 |
'mode' => 'responsive', |
| 1927 |
'type' => 'dimensions', |
| 1928 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 1929 |
'size_units' => [ 'px', '%', 'em' ], |
| 1930 |
'selectors' => $selectors['border_radius'], |
| 1931 |
]; |
| 1932 |
|
| 1933 |
$fields = Fns::insert_controls( 'quick_view_button_border_hover_color', $fields, $extra_controls, true ); |
| 1934 |
|
| 1935 |
return apply_filters( 'rtsb/elements/elementor/quick_view_style_control', $fields, $obj ); |
| 1936 |
} |
| 1937 |
|
| 1938 |
/** |
| 1939 |
* Hover Icon Button Section |
| 1940 |
* |
| 1941 |
* @param object $obj Reference object. |
| 1942 |
* |
| 1943 |
* @return array |
| 1944 |
*/ |
| 1945 |
public static function hover_icon_button( $obj ): array { |
| 1946 |
$css_selectors = $obj->selectors['hover_icon_button']; |
| 1947 |
$title = esc_html__( 'Hover Icon Button', 'shopbuilder' ); |
| 1948 |
$condition = [ |
| 1949 |
'layout' => [ 'grid-layout2', 'slider-layout2' ], |
| 1950 |
]; |
| 1951 |
$selectors = [ |
| 1952 |
'typography' => $css_selectors['typography'], |
| 1953 |
'icon_size' => [ |
| 1954 |
$css_selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}} !important;', |
| 1955 |
$css_selectors['icon_size']['svg'] => 'width: {{SIZE}}{{UNIT}} !important;', |
| 1956 |
], |
| 1957 |
'hover_icon_spacing' => [ $css_selectors['hover_icon_spacing'] => 'margin-left: {{SIZE}}{{UNIT}}' ], |
| 1958 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}}' ], |
| 1959 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}}' ], |
| 1960 |
'icon_color' => [ $css_selectors['icon_color'] => 'color: {{VALUE}}' ], |
| 1961 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}}' ], |
| 1962 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 1963 |
'hover_icon_color' => [ $css_selectors['hover_icon_color'] => 'color: {{VALUE}}' ], |
| 1964 |
'border' => $css_selectors['border'], |
| 1965 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}}' ], |
| 1966 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}' ], |
| 1967 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1968 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 1969 |
]; |
| 1970 |
|
| 1971 |
$fields = ControlHelper::general_elementor_style( 'hover_icon_button', $title, $obj, $condition, $selectors ); |
| 1972 |
|
| 1973 |
$fields['hover_icon_button_alignment'] = [ |
| 1974 |
'type' => 'slider', |
| 1975 |
'mode' => 'responsive', |
| 1976 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 1977 |
'size_units' => [ 'px' ], |
| 1978 |
'range' => [ |
| 1979 |
'px' => [ |
| 1980 |
'min' => 0, |
| 1981 |
'max' => 100, |
| 1982 |
], |
| 1983 |
], |
| 1984 |
'default' => [ |
| 1985 |
'unit' => 'px', |
| 1986 |
'size' => 14, |
| 1987 |
], |
| 1988 |
'condition' => [ |
| 1989 |
'show_hover_btn_icon' => [ 'yes' ], |
| 1990 |
], |
| 1991 |
'selectors' => $selectors['icon_size'], |
| 1992 |
]; |
| 1993 |
|
| 1994 |
$extra_controls = []; |
| 1995 |
|
| 1996 |
$extra_controls['hover_icon_button_spacing'] = [ |
| 1997 |
'type' => 'slider', |
| 1998 |
'mode' => 'responsive', |
| 1999 |
'label' => esc_html__( 'Icon Spacing', 'shopbuilder' ), |
| 2000 |
'size_units' => [ 'px' ], |
| 2001 |
'range' => [ |
| 2002 |
'px' => [ |
| 2003 |
'min' => 0, |
| 2004 |
'max' => 100, |
| 2005 |
], |
| 2006 |
], |
| 2007 |
'default' => [ |
| 2008 |
'unit' => 'px', |
| 2009 |
'size' => 5, |
| 2010 |
], |
| 2011 |
'condition' => [ |
| 2012 |
'show_hover_btn_icon' => [ 'yes' ], |
| 2013 |
], |
| 2014 |
'selectors' => $selectors['hover_icon_spacing'], |
| 2015 |
]; |
| 2016 |
|
| 2017 |
$fields = Fns::insert_controls( 'hover_icon_button_alignment', $fields, $extra_controls, true ); |
| 2018 |
|
| 2019 |
$extra_controls['hover_icon_button_icon_color'] = [ |
| 2020 |
'type' => 'color', |
| 2021 |
'label' => esc_html__( 'Icon Color', 'shopbuilder' ), |
| 2022 |
'condition' => [ |
| 2023 |
'show_hover_btn_icon' => [ 'yes' ], |
| 2024 |
], |
| 2025 |
'selectors' => $selectors['icon_color'], |
| 2026 |
]; |
| 2027 |
|
| 2028 |
$fields = Fns::insert_controls( 'hover_icon_button_bg_color', $fields, $extra_controls, true ); |
| 2029 |
|
| 2030 |
$extra_controls['hover_icon_button_hover_icon_color'] = [ |
| 2031 |
'type' => 'color', |
| 2032 |
'label' => esc_html__( 'Hover Icon Color', 'shopbuilder' ), |
| 2033 |
'condition' => [ |
| 2034 |
'show_hover_btn_icon' => [ 'yes' ], |
| 2035 |
], |
| 2036 |
'selectors' => $selectors['hover_icon_color'], |
| 2037 |
]; |
| 2038 |
|
| 2039 |
$fields = Fns::insert_controls( 'hover_icon_button_hover_bg_color', $fields, $extra_controls, true ); |
| 2040 |
|
| 2041 |
$extra_controls['hover_icon_button_radius'] = [ |
| 2042 |
'mode' => 'responsive', |
| 2043 |
'type' => 'dimensions', |
| 2044 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 2045 |
'size_units' => [ 'px', '%', 'em' ], |
| 2046 |
'selectors' => $selectors['border_radius'], |
| 2047 |
]; |
| 2048 |
|
| 2049 |
$fields = Fns::insert_controls( 'hover_icon_button_border_hover_color', $fields, $extra_controls, true ); |
| 2050 |
|
| 2051 |
return apply_filters( 'rtsb/elements/elementor/hover_icon_btn_style_control', $fields, $obj ); |
| 2052 |
} |
| 2053 |
|
| 2054 |
/** |
| 2055 |
* Share Items Section |
| 2056 |
* |
| 2057 |
* @param object $obj Reference object. |
| 2058 |
* |
| 2059 |
* @return array |
| 2060 |
*/ |
| 2061 |
public static function share_items( $obj ): array { |
| 2062 |
$css_selectors = $obj->selectors['share_items']; |
| 2063 |
$title = esc_html__( 'Share Items', 'shopbuilder' ); |
| 2064 |
$condition = [ |
| 2065 |
'layout!' => [ 'default' ], |
| 2066 |
]; |
| 2067 |
$selectors = [ |
| 2068 |
'share_icons_spacing' => [ $css_selectors['share_icons_spacing'] => 'gap: {{SIZE}}{{UNIT}}' ], |
| 2069 |
'share_items_min_width' => [ $css_selectors['share_items_min_width'] => 'min-width: {{SIZE}}{{UNIT}}' ], |
| 2070 |
'social_items_color' => [ $css_selectors['social_items_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2071 |
'social_items_bg_color' => [ $css_selectors['social_items_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2072 |
'facebook_color' => [ $css_selectors['facebook_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2073 |
'twitter_color' => [ $css_selectors['twitter_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2074 |
'linkedin_color' => [ $css_selectors['linkedin_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2075 |
'pinterest_color' => [ $css_selectors['pinterest_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2076 |
'skype_color' => [ $css_selectors['skype_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2077 |
'whatsapp_color' => [ $css_selectors['whatsapp_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2078 |
'reddit_color' => [ $css_selectors['reddit_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2079 |
'telegram_color' => [ $css_selectors['telegram_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2080 |
'facebook_bg_color' => [ $css_selectors['facebook_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2081 |
'twitter_bg_color' => [ $css_selectors['twitter_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2082 |
'linkedin_bg_color' => [ $css_selectors['linkedin_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2083 |
'pinterest_bg_color' => [ $css_selectors['pinterest_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2084 |
'skype_bg_color' => [ $css_selectors['skype_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2085 |
'whatsapp_bg_color' => [ $css_selectors['whatsapp_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2086 |
'reddit_bg_color' => [ $css_selectors['reddit_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2087 |
'telegram_bg_color' => [ $css_selectors['telegram_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2088 |
'social_items_hover_color' => [ $css_selectors['social_items_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2089 |
'social_items_hover_bg_color' => [ $css_selectors['social_items_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2090 |
'facebook_hover_color' => [ $css_selectors['facebook_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2091 |
'twitter_hover_color' => [ $css_selectors['twitter_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2092 |
'linkedin_hover_color' => [ $css_selectors['linkedin_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2093 |
'pinterest_hover_color' => [ $css_selectors['pinterest_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2094 |
'skype_hover_color' => [ $css_selectors['skype_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2095 |
'whatsapp_hover_color' => [ $css_selectors['whatsapp_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2096 |
'reddit_hover_color' => [ $css_selectors['reddit_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2097 |
'telegram_hover_color' => [ $css_selectors['telegram_hover_color'] => 'fill: {{VALUE}}; color: {{VALUE}}' ], |
| 2098 |
'facebook_hover_bg_color' => [ $css_selectors['facebook_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2099 |
'twitter_hover_bg_color' => [ $css_selectors['twitter_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2100 |
'linkedin_hover_bg_color' => [ $css_selectors['linkedin_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2101 |
'pinterest_hover_bg_color' => [ $css_selectors['pinterest_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2102 |
'skype_hover_bg_color' => [ $css_selectors['skype_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2103 |
'whatsapp_hover_bg_color' => [ $css_selectors['whatsapp_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2104 |
'reddit_hover_bg_color' => [ $css_selectors['reddit_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2105 |
'telegram_hover_bg_color' => [ $css_selectors['telegram_hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2106 |
'border' => $css_selectors['border'], |
| 2107 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}}' ], |
| 2108 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}' ], |
| 2109 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2110 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2111 |
]; |
| 2112 |
|
| 2113 |
$fields = ControlHelper::general_elementor_style( 'share_items', $title, $obj, $condition, $selectors ); |
| 2114 |
|
| 2115 |
unset( |
| 2116 |
$fields['rtsb_el_share_items_typography'], |
| 2117 |
$fields['share_items_alignment'], |
| 2118 |
$fields['share_items_hover_color'], |
| 2119 |
$fields['share_items_hover_bg_color'], |
| 2120 |
$fields['share_items_color'], |
| 2121 |
$fields['share_items_bg_color'] |
| 2122 |
); |
| 2123 |
|
| 2124 |
$extra_controls = []; |
| 2125 |
|
| 2126 |
$extra_controls['share_items_spacing'] = [ |
| 2127 |
'type' => 'slider', |
| 2128 |
'mode' => 'responsive', |
| 2129 |
'label' => esc_html__( 'Items Spacing', 'shopbuilder' ), |
| 2130 |
'size_units' => [ 'px' ], |
| 2131 |
'range' => [ |
| 2132 |
'px' => [ |
| 2133 |
'min' => 0, |
| 2134 |
'max' => 100, |
| 2135 |
], |
| 2136 |
], |
| 2137 |
'selectors' => $selectors['share_icons_spacing'], |
| 2138 |
]; |
| 2139 |
|
| 2140 |
$extra_controls['share_items_min_width'] = [ |
| 2141 |
'type' => 'slider', |
| 2142 |
'mode' => 'responsive', |
| 2143 |
'label' => esc_html__( 'Items Min Width', 'shopbuilder' ), |
| 2144 |
'size_units' => [ 'px' ], |
| 2145 |
'range' => [ |
| 2146 |
'px' => [ |
| 2147 |
'min' => 0, |
| 2148 |
'max' => 300, |
| 2149 |
], |
| 2150 |
], |
| 2151 |
'selectors' => $selectors['share_items_min_width'], |
| 2152 |
]; |
| 2153 |
|
| 2154 |
$fields = Fns::insert_controls( 'share_items_typo_note', $fields, $extra_controls, true ); |
| 2155 |
|
| 2156 |
$share_platforms = ControlHelper::sharing_settings(); |
| 2157 |
|
| 2158 |
$extra_controls['social_items_color'] = [ |
| 2159 |
'type' => 'color', |
| 2160 |
'label' => esc_html__( 'Items Color', 'shopbuilder' ), |
| 2161 |
'selectors' => $selectors['social_items_color'], |
| 2162 |
]; |
| 2163 |
|
| 2164 |
$extra_controls['social_items_bg_color'] = [ |
| 2165 |
'type' => 'color', |
| 2166 |
'label' => esc_html__( 'Items Background Color', 'shopbuilder' ), |
| 2167 |
'selectors' => $selectors['social_items_bg_color'], |
| 2168 |
]; |
| 2169 |
|
| 2170 |
foreach ( $share_platforms as $share_platform ) { |
| 2171 |
$extra_controls[ $share_platform . '_color' ] = [ |
| 2172 |
'type' => 'color', |
| 2173 |
'label' => ucfirst( $share_platform ) . esc_html__( ' Color', 'shopbuilder' ), |
| 2174 |
'selectors' => $selectors[ $share_platform . '_color' ], |
| 2175 |
]; |
| 2176 |
|
| 2177 |
$extra_controls[ $share_platform . '_bg_color' ] = [ |
| 2178 |
'type' => 'color', |
| 2179 |
'label' => ucfirst( $share_platform ) . esc_html__( ' Background', 'shopbuilder' ), |
| 2180 |
'selectors' => $selectors[ $share_platform . '_bg_color' ], |
| 2181 |
]; |
| 2182 |
|
| 2183 |
$fields = Fns::insert_controls( 'share_items_color_tab', $fields, $extra_controls, true ); |
| 2184 |
} |
| 2185 |
|
| 2186 |
$extra_controls['social_items_hover_color'] = [ |
| 2187 |
'type' => 'color', |
| 2188 |
'label' => esc_html__( 'Items Hover Color', 'shopbuilder' ), |
| 2189 |
'selectors' => $selectors['social_items_hover_color'], |
| 2190 |
]; |
| 2191 |
|
| 2192 |
$extra_controls['social_items_hover_bg_color'] = [ |
| 2193 |
'type' => 'color', |
| 2194 |
'label' => esc_html__( 'Items Background Hover Color', 'shopbuilder' ), |
| 2195 |
'selectors' => $selectors['social_items_hover_bg_color'], |
| 2196 |
]; |
| 2197 |
|
| 2198 |
foreach ( $share_platforms as $share_platform ) { |
| 2199 |
$extra_controls[ $share_platform . '_hover_color' ] = [ |
| 2200 |
'type' => 'color', |
| 2201 |
'label' => ucfirst( $share_platform ) . esc_html__( ' Hover Color', 'shopbuilder' ), |
| 2202 |
'selectors' => $selectors[ $share_platform . '_hover_color' ], |
| 2203 |
]; |
| 2204 |
|
| 2205 |
$extra_controls[ $share_platform . '_hover_bg_color' ] = [ |
| 2206 |
'type' => 'color', |
| 2207 |
'label' => ucfirst( $share_platform ) . esc_html__( ' Hover Background', 'shopbuilder' ), |
| 2208 |
'selectors' => $selectors[ $share_platform . '_hover_bg_color' ], |
| 2209 |
]; |
| 2210 |
|
| 2211 |
$fields = Fns::insert_controls( 'share_items_hover_color_tab', $fields, $extra_controls, true ); |
| 2212 |
} |
| 2213 |
|
| 2214 |
$extra_controls['share_items_radius'] = [ |
| 2215 |
'mode' => 'responsive', |
| 2216 |
'type' => 'dimensions', |
| 2217 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 2218 |
'size_units' => [ 'px', '%', 'em' ], |
| 2219 |
'selectors' => $selectors['border_radius'], |
| 2220 |
]; |
| 2221 |
|
| 2222 |
$fields = Fns::insert_controls( 'share_items_border_hover_color', $fields, $extra_controls, true ); |
| 2223 |
|
| 2224 |
return apply_filters( 'rtsb/elements/elementor/share_icons_style_control', $fields, $obj ); |
| 2225 |
} |
| 2226 |
|
| 2227 |
/** |
| 2228 |
* Share Icons Section |
| 2229 |
* |
| 2230 |
* @param object $obj Reference object. |
| 2231 |
* |
| 2232 |
* @return array |
| 2233 |
*/ |
| 2234 |
public static function share_icons( $obj ): array { |
| 2235 |
$css_selectors = $obj->selectors['share_icons']; |
| 2236 |
$title = esc_html__( 'Share Icons', 'shopbuilder' ); |
| 2237 |
$condition = [ |
| 2238 |
'layout!' => [ 'default' ], |
| 2239 |
]; |
| 2240 |
$selectors = [ |
| 2241 |
'share_icons_width' => [ $css_selectors['share_icons_width'] => 'width: {{SIZE}}{{UNIT}}' ], |
| 2242 |
'share_icons_height' => [ $css_selectors['share_icons_height'] => 'height: {{SIZE}}{{UNIT}}' ], |
| 2243 |
'color' => [ $css_selectors['color'] => 'fill: {{VALUE}}' ], |
| 2244 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}}' ], |
| 2245 |
'hover_color' => [ $css_selectors['hover_color'] => 'fill: {{VALUE}}' ], |
| 2246 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2247 |
'border' => $css_selectors['border'], |
| 2248 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}}' ], |
| 2249 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2250 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2251 |
]; |
| 2252 |
|
| 2253 |
$fields = ControlHelper::general_elementor_style( 'share_icons', $title, $obj, $condition, $selectors ); |
| 2254 |
|
| 2255 |
unset( |
| 2256 |
$fields['rtsb_el_share_icons_typography'], |
| 2257 |
$fields['share_icons_alignment'], |
| 2258 |
); |
| 2259 |
|
| 2260 |
$extra_controls = []; |
| 2261 |
|
| 2262 |
$extra_controls['share_icons_width'] = [ |
| 2263 |
'type' => 'slider', |
| 2264 |
'mode' => 'responsive', |
| 2265 |
'label' => esc_html__( 'Icon Width', 'shopbuilder' ), |
| 2266 |
'size_units' => [ 'px' ], |
| 2267 |
'range' => [ |
| 2268 |
'px' => [ |
| 2269 |
'min' => 0, |
| 2270 |
'max' => 100, |
| 2271 |
], |
| 2272 |
], |
| 2273 |
'selectors' => $selectors['share_icons_width'], |
| 2274 |
]; |
| 2275 |
|
| 2276 |
$extra_controls['share_icons_height'] = [ |
| 2277 |
'type' => 'slider', |
| 2278 |
'mode' => 'responsive', |
| 2279 |
'label' => esc_html__( 'Icon Height', 'shopbuilder' ), |
| 2280 |
'size_units' => [ 'px' ], |
| 2281 |
'range' => [ |
| 2282 |
'px' => [ |
| 2283 |
'min' => 0, |
| 2284 |
'max' => 100, |
| 2285 |
], |
| 2286 |
], |
| 2287 |
'selectors' => $selectors['share_icons_height'], |
| 2288 |
]; |
| 2289 |
|
| 2290 |
$fields = Fns::insert_controls( 'share_icons_typo_note', $fields, $extra_controls, true ); |
| 2291 |
|
| 2292 |
$fields['share_icons_typo_note']['raw'] = sprintf( |
| 2293 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 2294 |
esc_html__( 'Dimension', 'shopbuilder' ) |
| 2295 |
); |
| 2296 |
|
| 2297 |
return apply_filters( 'rtsb/elements/elementor/share_icons_style_control', $fields, $obj ); |
| 2298 |
} |
| 2299 |
|
| 2300 |
/** |
| 2301 |
* Share Text Section |
| 2302 |
* |
| 2303 |
* @param object $obj Reference object. |
| 2304 |
* |
| 2305 |
* @return array |
| 2306 |
*/ |
| 2307 |
public static function share_text( $obj ): array { |
| 2308 |
$css_selectors = $obj->selectors['share_text']; |
| 2309 |
$title = esc_html__( 'Share Text', 'shopbuilder' ); |
| 2310 |
$condition = [ |
| 2311 |
'layout!' => [ 'default' ], |
| 2312 |
]; |
| 2313 |
$selectors = [ |
| 2314 |
'typography' => $css_selectors['typography'], |
| 2315 |
'alignment' => [ $css_selectors['alignment'] => 'text-align: {{VALUE}};' ], |
| 2316 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 2317 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}}' ], |
| 2318 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}}' ], |
| 2319 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}}' ], |
| 2320 |
'border' => $css_selectors['border'], |
| 2321 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}}' ], |
| 2322 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2323 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2324 |
]; |
| 2325 |
|
| 2326 |
$fields = ControlHelper::general_elementor_style( 'share_text', $title, $obj, $condition, $selectors ); |
| 2327 |
|
| 2328 |
// text-align only bites on Preset 2, whose label has a min-width for the text to |
| 2329 |
// align within; Preset 1's label is exactly text-width, so hide the control there. |
| 2330 |
$fields['share_text_alignment']['condition'] = [ 'layout' => 'share-layout2' ]; |
| 2331 |
|
| 2332 |
return apply_filters( 'rtsb/elements/elementor/share_text_style_control', $fields, $obj ); |
| 2333 |
} |
| 2334 |
|
| 2335 |
/** |
| 2336 |
* Share Text Section |
| 2337 |
* |
| 2338 |
* @param object $obj Reference object. |
| 2339 |
* |
| 2340 |
* @return array |
| 2341 |
*/ |
| 2342 |
public static function share_header( $obj ): array { |
| 2343 |
$css_selectors = $obj->selectors['share_header']; |
| 2344 |
$title = esc_html__( 'Share Header', 'shopbuilder' ); |
| 2345 |
$condition = [ |
| 2346 |
'show_share_pre_text' => [ 'yes' ], |
| 2347 |
]; |
| 2348 |
$selectors = [ |
| 2349 |
'typography' => $css_selectors['typography'], |
| 2350 |
'share_header_type' => [ $css_selectors['share_header_type'] => 'display: {{VALUE}};' ], |
| 2351 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 2352 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}}' ], |
| 2353 |
'border' => $css_selectors['border'], |
| 2354 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2355 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 2356 |
]; |
| 2357 |
|
| 2358 |
$fields = ControlHelper::general_elementor_style( 'share_header', $title, $obj, $condition, $selectors ); |
| 2359 |
|
| 2360 |
unset( |
| 2361 |
$fields['share_header_alignment'], |
| 2362 |
$fields['share_header_color_tabs'], |
| 2363 |
$fields['share_header_color_tab'], |
| 2364 |
$fields['share_header_color_tab_end'], |
| 2365 |
$fields['share_header_hover_color_tab'], |
| 2366 |
$fields['share_header_hover_color'], |
| 2367 |
$fields['share_header_hover_bg_color'], |
| 2368 |
$fields['share_header_hover_color_tab_end'], |
| 2369 |
$fields['share_header_color_tabs_end'], |
| 2370 |
$fields['share_header_border_hover_color'], |
| 2371 |
); |
| 2372 |
|
| 2373 |
$extra_controls = []; |
| 2374 |
|
| 2375 |
$extra_controls['share_header_type'] = [ |
| 2376 |
'type' => 'choose', |
| 2377 |
'label' => esc_html__( 'Display Type', 'shopbuilder' ), |
| 2378 |
'options' => [ |
| 2379 |
'flex' => [ |
| 2380 |
'title' => esc_html__( 'Inline', 'shopbuilder' ), |
| 2381 |
'icon' => 'eicon-h-align-right', |
| 2382 |
], |
| 2383 |
'block' => [ |
| 2384 |
'title' => esc_html__( 'New Line', 'shopbuilder' ), |
| 2385 |
'icon' => 'eicon-v-align-bottom', |
| 2386 |
], |
| 2387 |
], |
| 2388 |
'default' => 'flex', |
| 2389 |
'toggle' => true, |
| 2390 |
'selectors' => $selectors['share_header_type'], |
| 2391 |
]; |
| 2392 |
|
| 2393 |
return Fns::insert_controls( 'share_header_color_note', $fields, $extra_controls ); |
| 2394 |
} |
| 2395 |
|
| 2396 |
/** |
| 2397 |
* Advanced section |
| 2398 |
* |
| 2399 |
* @param object $obj Reference object. |
| 2400 |
* |
| 2401 |
* @return array |
| 2402 |
*/ |
| 2403 |
public static function advanced( $obj ): array { |
| 2404 |
|
| 2405 |
$fields['advanced_section'] = $obj->start_section( esc_html__( 'Advanced', 'shopbuilder' ), self::$tab ); |
| 2406 |
|
| 2407 |
$fields['gutter_section_end'] = $obj->end_section(); |
| 2408 |
|
| 2409 |
return apply_filters( 'rtsb/elements/elementor/advanced_control', $fields, $obj ); |
| 2410 |
} |
| 2411 |
|
| 2412 |
/** |
| 2413 |
* Slider buttons section |
| 2414 |
* |
| 2415 |
* @param object $obj Reference object. |
| 2416 |
* |
| 2417 |
* @return array |
| 2418 |
*/ |
| 2419 |
public static function slider_buttons( $obj ): array { |
| 2420 |
$css_selectors = $obj->selectors['slider_buttons']; |
| 2421 |
$title = esc_html__( 'Slider Buttons', 'shopbuilder' ); |
| 2422 |
$selectors = [ |
| 2423 |
'arrow_size' => [ |
| 2424 |
$css_selectors['arrow_size']['icon'] => 'font-size: {{SIZE}}{{UNIT}};', |
| 2425 |
$css_selectors['arrow_size']['svg'] => 'width: {{SIZE}}{{UNIT}};', |
| 2426 |
], |
| 2427 |
'arrow_width' => [ $css_selectors['arrow_width'] => 'width: {{SIZE}}{{UNIT}};' ], |
| 2428 |
'arrow_height' => [ $css_selectors['arrow_height'] => 'height: {{SIZE}}{{UNIT}};' ], |
| 2429 |
'arrow_line_height' => [ $css_selectors['arrow_line_height'] => 'line-height: {{SIZE}}{{UNIT}};' ], |
| 2430 |
'dot_width' => [ $css_selectors['dot_width'] => 'width: {{SIZE}}{{UNIT}};' ], |
| 2431 |
'dot_height' => [ $css_selectors['dot_height'] => 'height: {{SIZE}}{{UNIT}};' ], |
| 2432 |
'dot_spacing' => [ $css_selectors['dot_spacing'] => 'margin-left: calc({{SIZE}}{{UNIT}} / 2); margin-right: calc({{SIZE}}{{UNIT}} / 2);' ], |
| 2433 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 2434 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 2435 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 2436 |
'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 2437 |
'dot_color' => [ $css_selectors['dot_color'] => 'background-color: {{VALUE}};' ], |
| 2438 |
'dot_active_color' => [ $css_selectors['dot_active_color'] => 'background-color: {{VALUE}};' ], |
| 2439 |
'border' => $css_selectors['border'], |
| 2440 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 2441 |
'active_border_color' => [ $css_selectors['active_border_color'] => 'border-color: {{VALUE}};' ], |
| 2442 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2443 |
'wrapper_padding' => [ $css_selectors['wrapper_padding'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2444 |
]; |
| 2445 |
|
| 2446 |
$conditions = [ |
| 2447 |
'relation' => 'or', |
| 2448 |
'terms' => [ |
| 2449 |
[ |
| 2450 |
'name' => 'slider_nav', |
| 2451 |
'operator' => '==', |
| 2452 |
'value' => 'yes', |
| 2453 |
], |
| 2454 |
[ |
| 2455 |
'name' => 'slider_pagi', |
| 2456 |
'operator' => '==', |
| 2457 |
'value' => 'yes', |
| 2458 |
], |
| 2459 |
], |
| 2460 |
]; |
| 2461 |
|
| 2462 |
$fields = ControlHelper::general_elementor_style( 'slider_buttons', $title, $obj, [], $selectors, $conditions ); |
| 2463 |
|
| 2464 |
$fields = Fns::insert_controls( |
| 2465 |
'slider_buttons_style_section', |
| 2466 |
$fields, |
| 2467 |
[ |
| 2468 |
'slider_buttons_section_note' => [ |
| 2469 |
'type' => 'html', |
| 2470 |
'separator' => 'after', |
| 2471 |
'raw' => '<p class="rtsb-el-notice">' . esc_html__( 'This section is not for the gallery image slider controls. It only controls the product slider section. The Gallery Thumbnail Slider style controls are located inside the "Image Styles" section.', 'shopbuilder' ) . '</p>', |
| 2472 |
], |
| 2473 |
], |
| 2474 |
true |
| 2475 |
); |
| 2476 |
|
| 2477 |
unset( |
| 2478 |
$fields['rtsb_el_slider_buttons_typography'], |
| 2479 |
$fields['slider_buttons_alignment'], |
| 2480 |
$fields['slider_buttons_padding'], |
| 2481 |
$fields['slider_buttons_margin'] |
| 2482 |
); |
| 2483 |
|
| 2484 |
$extra_controls = []; |
| 2485 |
$arrow_condition = [ 'slider_nav' => [ 'yes' ] ]; |
| 2486 |
$dot_condition = [ 'slider_pagi' => [ 'yes' ] ]; |
| 2487 |
|
| 2488 |
$fields['slider_buttons_typo_note']['raw'] = sprintf( |
| 2489 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 2490 |
esc_html__( 'Arrow Size (px)', 'shopbuilder' ) |
| 2491 |
); |
| 2492 |
|
| 2493 |
$fields['slider_buttons_typo_note']['condition'] = $arrow_condition; |
| 2494 |
|
| 2495 |
$extra_controls['slider_buttons_arrow_size'] = [ |
| 2496 |
'type' => 'slider', |
| 2497 |
'mode' => 'responsive', |
| 2498 |
'label' => esc_html__( 'Arrow Size', 'shopbuilder' ), |
| 2499 |
'range' => [ |
| 2500 |
'px' => [ |
| 2501 |
'min' => 1, |
| 2502 |
'max' => 100, |
| 2503 |
'step' => 1, |
| 2504 |
], |
| 2505 |
], |
| 2506 |
'default' => [ |
| 2507 |
'unit' => 'px', |
| 2508 |
'size' => 13, |
| 2509 |
], |
| 2510 |
'condition' => $arrow_condition, |
| 2511 |
'selectors' => $selectors['arrow_size'], |
| 2512 |
]; |
| 2513 |
|
| 2514 |
$extra_controls['slider_buttons_arrow_width'] = [ |
| 2515 |
'type' => 'slider', |
| 2516 |
'mode' => 'responsive', |
| 2517 |
'label' => esc_html__( 'Arrow Width', 'shopbuilder' ), |
| 2518 |
'range' => [ |
| 2519 |
'px' => [ |
| 2520 |
'min' => 1, |
| 2521 |
'max' => 100, |
| 2522 |
'step' => 1, |
| 2523 |
], |
| 2524 |
], |
| 2525 |
'condition' => $arrow_condition, |
| 2526 |
'selectors' => $selectors['arrow_width'], |
| 2527 |
]; |
| 2528 |
|
| 2529 |
$extra_controls['slider_buttons_arrow_height'] = [ |
| 2530 |
'type' => 'slider', |
| 2531 |
'mode' => 'responsive', |
| 2532 |
'label' => esc_html__( 'Arrow Height', 'shopbuilder' ), |
| 2533 |
'range' => [ |
| 2534 |
'px' => [ |
| 2535 |
'min' => 1, |
| 2536 |
'max' => 100, |
| 2537 |
'step' => 1, |
| 2538 |
], |
| 2539 |
], |
| 2540 |
'condition' => $arrow_condition, |
| 2541 |
'selectors' => $selectors['arrow_height'], |
| 2542 |
]; |
| 2543 |
|
| 2544 |
$extra_controls['slider_buttons_arrow_line_height'] = [ |
| 2545 |
'type' => 'slider', |
| 2546 |
'mode' => 'responsive', |
| 2547 |
'label' => esc_html__( 'Arrow Line Height', 'shopbuilder' ), |
| 2548 |
'range' => [ |
| 2549 |
'px' => [ |
| 2550 |
'min' => 1, |
| 2551 |
'max' => 100, |
| 2552 |
'step' => 1, |
| 2553 |
], |
| 2554 |
], |
| 2555 |
'condition' => $arrow_condition, |
| 2556 |
'selectors' => $selectors['arrow_line_height'], |
| 2557 |
]; |
| 2558 |
|
| 2559 |
$extra_controls['slider_buttons_dot_size_note'] = $obj->el_heading( |
| 2560 |
esc_html__( 'Dot Size (px)', 'shopbuilder' ), |
| 2561 |
'before', |
| 2562 |
[], |
| 2563 |
$dot_condition |
| 2564 |
); |
| 2565 |
|
| 2566 |
$extra_controls['slider_buttons_dot_width'] = [ |
| 2567 |
'type' => 'slider', |
| 2568 |
'mode' => 'responsive', |
| 2569 |
'label' => esc_html__( 'Dot Width', 'shopbuilder' ), |
| 2570 |
'range' => [ |
| 2571 |
'px' => [ |
| 2572 |
'min' => 1, |
| 2573 |
'max' => 100, |
| 2574 |
'step' => 1, |
| 2575 |
], |
| 2576 |
], |
| 2577 |
'selectors' => $selectors['dot_width'], |
| 2578 |
'condition' => $dot_condition, |
| 2579 |
]; |
| 2580 |
|
| 2581 |
$extra_controls['slider_buttons_dot_height'] = [ |
| 2582 |
'type' => 'slider', |
| 2583 |
'mode' => 'responsive', |
| 2584 |
'label' => esc_html__( 'Dot Height', 'shopbuilder' ), |
| 2585 |
'range' => [ |
| 2586 |
'px' => [ |
| 2587 |
'min' => 1, |
| 2588 |
'max' => 100, |
| 2589 |
'step' => 1, |
| 2590 |
], |
| 2591 |
], |
| 2592 |
'selectors' => $selectors['dot_height'], |
| 2593 |
'condition' => $dot_condition, |
| 2594 |
]; |
| 2595 |
|
| 2596 |
$extra_controls['slider_buttons_dot_spacing'] = [ |
| 2597 |
'type' => 'slider', |
| 2598 |
'mode' => 'responsive', |
| 2599 |
'label' => esc_html__( 'Dot Spacing', 'shopbuilder' ), |
| 2600 |
'range' => [ |
| 2601 |
'px' => [ |
| 2602 |
'min' => 1, |
| 2603 |
'max' => 100, |
| 2604 |
'step' => 1, |
| 2605 |
], |
| 2606 |
], |
| 2607 |
'selectors' => $selectors['dot_spacing'], |
| 2608 |
'condition' => $dot_condition, |
| 2609 |
]; |
| 2610 |
|
| 2611 |
$fields = Fns::insert_controls( 'slider_buttons_typo_note', $fields, $extra_controls, true ); |
| 2612 |
|
| 2613 |
$extra_controls['slider_buttons_active_color_tab'] = $obj->start_tab( esc_html__( 'Dot', 'shopbuilder' ) ); |
| 2614 |
|
| 2615 |
$extra_controls['slider_buttons_active_color'] = [ |
| 2616 |
'type' => 'color', |
| 2617 |
'label' => esc_html__( 'Dot Color', 'shopbuilder' ), |
| 2618 |
'selectors' => $selectors['dot_color'], |
| 2619 |
]; |
| 2620 |
|
| 2621 |
$extra_controls['slider_buttons_active_bg_color'] = [ |
| 2622 |
'type' => 'color', |
| 2623 |
'label' => esc_html__( 'Dot Active Color', 'shopbuilder' ), |
| 2624 |
'selectors' => $selectors['dot_active_color'], |
| 2625 |
]; |
| 2626 |
|
| 2627 |
$extra_controls['slider_buttons_active_color_tab_end'] = $obj->end_tab(); |
| 2628 |
|
| 2629 |
$fields = Fns::insert_controls( 'slider_buttons_hover_color_tab_end', $fields, $extra_controls, true ); |
| 2630 |
|
| 2631 |
$extra_controls['slider_buttons_border_active_color'] = [ |
| 2632 |
'type' => 'color', |
| 2633 |
'label' => esc_html__( 'Dot Active Border Color', 'shopbuilder' ), |
| 2634 |
'condition' => [ 'rtsb_el_slider_buttons_border_border!' => [ '' ] ], |
| 2635 |
'selectors' => $selectors['active_border_color'], |
| 2636 |
]; |
| 2637 |
|
| 2638 |
$extra_controls['slider_buttons_buttons_radius'] = [ |
| 2639 |
'mode' => 'responsive', |
| 2640 |
'type' => 'dimensions', |
| 2641 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 2642 |
'size_units' => [ 'px', '%', 'em' ], |
| 2643 |
'selectors' => $selectors['border_radius'], |
| 2644 |
]; |
| 2645 |
|
| 2646 |
$fields = Fns::insert_controls( 'slider_buttons_border_hover_color', $fields, $extra_controls, true ); |
| 2647 |
|
| 2648 |
$extra_controls['slider_buttons_wrapper_padding'] = [ |
| 2649 |
'mode' => 'responsive', |
| 2650 |
'type' => 'dimensions', |
| 2651 |
'label' => esc_html__( 'Arrow Margin', 'shopbuilder' ), |
| 2652 |
'size_units' => [ 'px', '%', 'em' ], |
| 2653 |
'selectors' => $selectors['wrapper_padding'], |
| 2654 |
]; |
| 2655 |
|
| 2656 |
$fields = Fns::insert_controls( 'slider_buttons_spacing_note', $fields, $extra_controls, true ); |
| 2657 |
|
| 2658 |
return apply_filters( 'rtsb/elements/elementor/slider_buttons_style_control', $fields, $obj ); |
| 2659 |
} |
| 2660 |
|
| 2661 |
/** |
| 2662 |
* Not Found Notice Section |
| 2663 |
* |
| 2664 |
* @param object $obj Reference object. |
| 2665 |
* |
| 2666 |
* @return array |
| 2667 |
*/ |
| 2668 |
public static function not_found_notice( $obj ): array { |
| 2669 |
$css_selectors = $obj->selectors['not_found_notice']; |
| 2670 |
$title = esc_html__( 'Not Found Notice', 'shopbuilder' ); |
| 2671 |
$selectors = [ |
| 2672 |
'typography' => $css_selectors['typography'], |
| 2673 |
'alignment' => [ $css_selectors['alignment'] => 'text-align: {{VALUE}}; justify-content: {{VALUE}};' ], |
| 2674 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 2675 |
'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 2676 |
'border' => $css_selectors['border'], |
| 2677 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2678 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 2679 |
]; |
| 2680 |
|
| 2681 |
$fields = ControlHelper::general_elementor_style( 'not_found_notice', $title, $obj, [], $selectors ); |
| 2682 |
|
| 2683 |
unset( |
| 2684 |
$fields['not_found_notice_color_tabs'], |
| 2685 |
$fields['not_found_notice_color_tab'], |
| 2686 |
$fields['not_found_notice_color_tab_end'], |
| 2687 |
$fields['not_found_notice_hover_color_tab'], |
| 2688 |
$fields['not_found_notice_hover_color'], |
| 2689 |
$fields['not_found_notice_hover_bg_color'], |
| 2690 |
$fields['not_found_notice_hover_color_tab_end'], |
| 2691 |
$fields['not_found_notice_color_tabs_end'], |
| 2692 |
$fields['not_found_notice_border_hover_color'] |
| 2693 |
); |
| 2694 |
|
| 2695 |
return $fields; |
| 2696 |
} |
| 2697 |
|
| 2698 |
/** |
| 2699 |
* Title Selectors. |
| 2700 |
* |
| 2701 |
* @param array $selectors Selector array. |
| 2702 |
* |
| 2703 |
* @return array |
| 2704 |
*/ |
| 2705 |
public static function title_selectors( $selectors ): array { |
| 2706 |
return [ |
| 2707 |
'typography' => $selectors['typography'], |
| 2708 |
'alignment' => [ $selectors['alignment'] => 'text-align: {{VALUE}};' ], |
| 2709 |
'color' => [ $selectors['color'] => 'color: {{VALUE}};' ], |
| 2710 |
'bg_color' => [ $selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 2711 |
'hover_color' => [ $selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 2712 |
'hover_bg_color' => [ $selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ], |
| 2713 |
'border' => $selectors['border'], |
| 2714 |
'border_hover_color' => [ $selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 2715 |
'padding' => [ $selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2716 |
'margin' => [ $selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 2717 |
]; |
| 2718 |
} |
| 2719 |
|
| 2720 |
/** |
| 2721 |
* Excerpt Selectors. |
| 2722 |
* |
| 2723 |
* @param array $selectors Selector array. |
| 2724 |
* |
| 2725 |
* @return array |
| 2726 |
*/ |
| 2727 |
private static function excerpt_selectors( $selectors ): array { |
| 2728 |
return [ |
| 2729 |
'typography' => $selectors['typography'], |
| 2730 |
'alignment' => [ $selectors['alignment'] => 'text-align: {{VALUE}};' ], |
| 2731 |
'color' => [ $selectors['color'] => 'color: {{VALUE}};' ], |
| 2732 |
'bg_color' => [ $selectors['bg_color'] => 'background-color: {{VALUE}};' ], |
| 2733 |
'border' => $selectors['border'], |
| 2734 |
'padding' => [ $selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2735 |
'margin' => [ $selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2736 |
]; |
| 2737 |
} |
| 2738 |
|
| 2739 |
/** |
| 2740 |
* Action Button Selectors. |
| 2741 |
* |
| 2742 |
* @param array $selectors Selector array. |
| 2743 |
* |
| 2744 |
* @return array |
| 2745 |
*/ |
| 2746 |
public static function action_btn_selectors( $selectors ): array { |
| 2747 |
return [ |
| 2748 |
'icon_size' => [ |
| 2749 |
$selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}} !important;', |
| 2750 |
$selectors['icon_size']['width'] => 'width: {{SIZE}}{{UNIT}} !important;', |
| 2751 |
], |
| 2752 |
'width' => [ $selectors['width'] => 'min-width: {{SIZE}}{{UNIT}} !important;' ], |
| 2753 |
'height' => [ $selectors['height'] => 'height: {{SIZE}}{{UNIT}} !important;' ], |
| 2754 |
'color' => [ $selectors['color'] => 'color: {{VALUE}};' ], |
| 2755 |
'bg_color' => [ $selectors['bg_color'] => 'background-color: {{VALUE}} !important;' ], |
| 2756 |
'hover_color' => [ $selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 2757 |
'hover_bg_color' => [ $selectors['hover_bg_color'] => 'background-color: {{VALUE}} !important;' ], |
| 2758 |
'border' => $selectors['border'], |
| 2759 |
'border_hover_color' => [ $selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 2760 |
'border_radius' => [ $selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 2761 |
'padding' => [ $selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 2762 |
'margin' => [ $selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], |
| 2763 |
]; |
| 2764 |
} |
| 2765 |
} |
| 2766 |
|