| 1 |
<?php |
| 2 |
/** |
| 3 |
* Controls class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\General\CallToAction; |
| 9 |
|
| 10 |
use RadiusTheme\SB\Helpers\Fns; |
| 11 |
use RadiusTheme\SB\Elementor\Helper\ControlHelper; |
| 12 |
|
| 13 |
// Do not allow directly accessing this file. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit( 'This script cannot be accessed directly.' ); |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Settings class. |
| 20 |
* |
| 21 |
* @package RadiusTheme\SB |
| 22 |
*/ |
| 23 |
class Controls { |
| 24 |
/** |
| 25 |
* Content section |
| 26 |
* |
| 27 |
* @param object $obj Reference object. |
| 28 |
* |
| 29 |
* @return array |
| 30 |
*/ |
| 31 |
public static function content( $obj ) { |
| 32 |
return array_merge( |
| 33 |
self::preset( $obj ), |
| 34 |
self::cta_title( $obj ), |
| 35 |
self::cta_content( $obj ), |
| 36 |
self::cta_button( $obj ), |
| 37 |
self::cta_image( $obj ), |
| 38 |
self::cta_parallax_effect( $obj ), |
| 39 |
); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Style section |
| 44 |
* |
| 45 |
* @param object $obj Reference object. |
| 46 |
* |
| 47 |
* @return array |
| 48 |
*/ |
| 49 |
public static function style( $obj ) { |
| 50 |
return array_merge( |
| 51 |
self::content_box_style( $obj ), |
| 52 |
self::image_style( $obj ), |
| 53 |
self::title_style( $obj ), |
| 54 |
self::content_style( $obj ), |
| 55 |
self::button_style( $obj, 'primary' ), |
| 56 |
self::button_style( $obj, 'secondary' ), |
| 57 |
); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Preset section |
| 62 |
* |
| 63 |
* @param object $obj Reference object. |
| 64 |
* |
| 65 |
* @return array |
| 66 |
*/ |
| 67 |
private static function preset( $obj ) { |
| 68 |
$alignment_options = ControlHelper::alignment(); |
| 69 |
unset( $alignment_options['justify'] ); |
| 70 |
$fields['cta_preset'] = $obj->start_section( |
| 71 |
esc_html__( 'Layout', 'shopbuilder' ), |
| 72 |
'content' |
| 73 |
); |
| 74 |
$fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) ); |
| 75 |
$fields['layout_style'] = [ |
| 76 |
'type' => 'rtsb-image-selector', |
| 77 |
'options' => ControlHelper::general_widgets_cta_layouts(), |
| 78 |
'default' => 'rtsb-cta-layout1', |
| 79 |
]; |
| 80 |
|
| 81 |
$fields['sb_button_hover_effect_note'] = $obj->el_heading( esc_html__( 'Button Hover Effect Preset', 'shopbuilder' ), 'before' ); |
| 82 |
$fields['button_hover_effects'] = [ |
| 83 |
'type' => 'rtsb-image-selector', |
| 84 |
'options' => ControlHelper::general_widgets_button_hover_effect_preset(), |
| 85 |
'default' => 'rtsb-sb-button-hover-effect-default', |
| 86 |
]; |
| 87 |
|
| 88 |
$fields['cta_element_alignment'] = [ |
| 89 |
'mode' => 'responsive', |
| 90 |
'type' => 'choose', |
| 91 |
'label' => esc_html__( 'Element Alignment', 'shopbuilder' ), |
| 92 |
'options' => $alignment_options, |
| 93 |
'separator' => 'before', |
| 94 |
'selectors' => [ $obj->selectors['layout']['alignment'] => 'text-align: {{VALUE}};' ], |
| 95 |
'condition' => [ |
| 96 |
'layout_style' => [ 'rtsb-cta-layout1' ], |
| 97 |
], |
| 98 |
]; |
| 99 |
$fields['hover_animation'] = [ |
| 100 |
'mode' => 'responsive', |
| 101 |
'type' => 'choose', |
| 102 |
'label' => esc_html__( 'Hover Animation', 'shopbuilder' ), |
| 103 |
'options' => [ |
| 104 |
'left' => [ |
| 105 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 106 |
'icon' => 'eicon-h-align-left', |
| 107 |
], |
| 108 |
'top' => [ |
| 109 |
'title' => esc_html__( 'Top', 'shopbuilder' ), |
| 110 |
'icon' => 'eicon-v-align-top', |
| 111 |
], |
| 112 |
'right' => [ |
| 113 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 114 |
'icon' => 'eicon-h-align-right', |
| 115 |
], |
| 116 |
|
| 117 |
], |
| 118 |
'toggle' => true, |
| 119 |
'default' => 'left', |
| 120 |
'condition' => [ |
| 121 |
'button_hover_effects' => [ 'rtsb-sb-button-hover-effect-preset2' ], |
| 122 |
], |
| 123 |
]; |
| 124 |
$fields['cta_column_gap'] = [ |
| 125 |
'type' => 'slider', |
| 126 |
'mode' => 'responsive', |
| 127 |
'label' => esc_html__( 'Column Gap', 'shopbuilder' ), |
| 128 |
'size_units' => [ '%', 'px' ], |
| 129 |
'range' => [ |
| 130 |
'%' => [ |
| 131 |
'min' => 0, |
| 132 |
'max' => 100, |
| 133 |
'step' => 1, |
| 134 |
], |
| 135 |
'px' => [ |
| 136 |
'min' => 0, |
| 137 |
'max' => 600, |
| 138 |
'step' => 1, |
| 139 |
], |
| 140 |
], |
| 141 |
'selectors' => [ |
| 142 |
$obj->selectors['image_style']['column_gap'] => 'gap: {{SIZE}}{{UNIT}};', |
| 143 |
], |
| 144 |
'condition' => [ |
| 145 |
'layout_style' => [ 'rtsb-cta-layout3' ], |
| 146 |
], |
| 147 |
|
| 148 |
]; |
| 149 |
$fields['cta_preset_end'] = $obj->end_section(); |
| 150 |
return $fields; |
| 151 |
} |
| 152 |
|
| 153 |
/** |
| 154 |
* Title section |
| 155 |
* |
| 156 |
* @param object $obj Reference object. |
| 157 |
* |
| 158 |
* @return array |
| 159 |
*/ |
| 160 |
private static function cta_title( $obj ) { |
| 161 |
$fields['cta_title_sec_start'] = $obj->start_section( |
| 162 |
esc_html__( 'Title', 'shopbuilder' ), |
| 163 |
'content' |
| 164 |
); |
| 165 |
$fields['cta_title_html_tag'] = [ |
| 166 |
'label' => esc_html__( 'Title Tag', 'shopbuilder' ), |
| 167 |
'description' => esc_html__( 'Please select the title tag.', 'shopbuilder' ), |
| 168 |
'type' => 'select', |
| 169 |
'options' => ControlHelper::heading_tags(), |
| 170 |
'default' => 'h2', |
| 171 |
'label_block' => true, |
| 172 |
]; |
| 173 |
$fields['cta_title'] = [ |
| 174 |
'label' => esc_html__( 'Title', 'shopbuilder' ), |
| 175 |
'description' => esc_html__( 'Please enter the call to action title text.', 'shopbuilder' ), |
| 176 |
'type' => 'textarea', |
| 177 |
'label_block' => true, |
| 178 |
'default' => __( 'ShopBuilder for Easy Store Customization', 'shopbuilder' ), |
| 179 |
]; |
| 180 |
|
| 181 |
$fields['cta_title_sec_end'] = $obj->end_section(); |
| 182 |
|
| 183 |
return $fields; |
| 184 |
} |
| 185 |
/** |
| 186 |
* Content section |
| 187 |
* |
| 188 |
* @param object $obj Reference object. |
| 189 |
* |
| 190 |
* @return array |
| 191 |
*/ |
| 192 |
private static function cta_content( $obj ) { |
| 193 |
$condition = [ |
| 194 |
'display_content' => 'yes', |
| 195 |
]; |
| 196 |
$fields['cta_content_sec_start'] = $obj->start_section( |
| 197 |
esc_html__( 'Description', 'shopbuilder' ), |
| 198 |
'content' |
| 199 |
); |
| 200 |
$fields['display_content'] = [ |
| 201 |
'label' => esc_html__( 'Show Content?', 'shopbuilder' ), |
| 202 |
'description' => esc_html__( 'Switch on to show content.', 'shopbuilder' ), |
| 203 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 204 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 205 |
'type' => 'switch', |
| 206 |
'default' => 'yes', |
| 207 |
]; |
| 208 |
$fields['cta_content'] = [ |
| 209 |
'label' => esc_html__( 'Content', 'shopbuilder' ), |
| 210 |
'description' => esc_html__( 'Please enter the call to action description text.', 'shopbuilder' ), |
| 211 |
'type' => 'wysiwyg', |
| 212 |
'label_block' => true, |
| 213 |
'default' => sprintf( '<p>%s</p>', esc_html__( 'ShopBuilder is a versatile plugin designed for Elementor Page Builder. This plugin helps you design and customize your online store easily, letting you create attractive product pages and improve the shopping experience for your customers.', 'shopbuilder' ) ), |
| 214 |
'condition' => $condition, |
| 215 |
]; |
| 216 |
$fields['cta_content_sec_end'] = $obj->end_section(); |
| 217 |
|
| 218 |
return $fields; |
| 219 |
} |
| 220 |
/** |
| 221 |
* Button section |
| 222 |
* |
| 223 |
* @param object $obj Reference object. |
| 224 |
* |
| 225 |
* @return array |
| 226 |
*/ |
| 227 |
private static function cta_button( $obj ) { |
| 228 |
$condition = [ |
| 229 |
'display_button' => 'yes', |
| 230 |
]; |
| 231 |
$condition2 = [ |
| 232 |
'display_button' => 'yes', |
| 233 |
'display_button2' => 'yes', |
| 234 |
]; |
| 235 |
$fields['cta_button_sec_start'] = $obj->start_section( |
| 236 |
esc_html__( 'Button', 'shopbuilder' ), |
| 237 |
'content' |
| 238 |
); |
| 239 |
$fields['display_button'] = [ |
| 240 |
'label' => esc_html__( 'Show Button?', 'shopbuilder' ), |
| 241 |
'description' => esc_html__( 'Switch on to show button.', 'shopbuilder' ), |
| 242 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 243 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 244 |
'type' => 'switch', |
| 245 |
'default' => 'yes', |
| 246 |
]; |
| 247 |
$fields['sb_button_icon'] = [ |
| 248 |
'label' => esc_html__( 'Button Icon', 'shopbuilder' ), |
| 249 |
'type' => 'icons', |
| 250 |
'default' => [ |
| 251 |
'value' => 'fas fa-arrow-right', |
| 252 |
'library' => 'fa-solid', |
| 253 |
], |
| 254 |
'condition' => $condition, |
| 255 |
]; |
| 256 |
$fields['sb_button_icon_position'] = [ |
| 257 |
'mode' => 'responsive', |
| 258 |
'type' => 'choose', |
| 259 |
'label' => esc_html__( 'Position', 'shopbuilder' ), |
| 260 |
'options' => [ |
| 261 |
'left' => [ |
| 262 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 263 |
'icon' => 'eicon-h-align-left', |
| 264 |
], |
| 265 |
'right' => [ |
| 266 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 267 |
'icon' => 'eicon-h-align-right', |
| 268 |
], |
| 269 |
|
| 270 |
], |
| 271 |
'toggle' => true, |
| 272 |
'default' => 'right', |
| 273 |
'condition' => $condition, |
| 274 |
]; |
| 275 |
$fields['sb_button_button1_note'] = $obj->el_heading( esc_html__( 'Primary Button', 'shopbuilder' ), 'default', [], $condition ); |
| 276 |
$fields['sb_button_content'] = [ |
| 277 |
'label' => esc_html__( 'Text', 'shopbuilder' ), |
| 278 |
'description' => esc_html__( 'Please enter the button text.', 'shopbuilder' ), |
| 279 |
'type' => 'text', |
| 280 |
'label_block' => true, |
| 281 |
'default' => __( 'Primary Button', 'shopbuilder' ), |
| 282 |
'condition' => $condition, |
| 283 |
]; |
| 284 |
$fields['sb_button_link'] = [ |
| 285 |
'type' => 'link', |
| 286 |
'label' => esc_html__( 'Link', 'shopbuilder' ), |
| 287 |
'description' => esc_html__( 'Please enter a button link.', 'shopbuilder' ), |
| 288 |
'placeholder' => esc_html__( 'https://custom-link.com', 'shopbuilder' ), |
| 289 |
'options' => [ 'url', 'is_external', 'nofollow' ], |
| 290 |
'condition' => $condition, |
| 291 |
]; |
| 292 |
$fields['display_button2'] = [ |
| 293 |
'label' => esc_html__( 'Show Secondary Button', 'shopbuilder' ), |
| 294 |
'description' => esc_html__( 'Switch on to show secondary button.', 'shopbuilder' ), |
| 295 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 296 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 297 |
'type' => 'switch', |
| 298 |
'condition' => $condition, |
| 299 |
]; |
| 300 |
$fields['sb_button_button2_note'] = $obj->el_heading( esc_html__( 'Secondary Button', 'shopbuilder' ), 'default', [], $condition2 ); |
| 301 |
$fields['sb_button2_content'] = [ |
| 302 |
'label' => esc_html__( 'Text', 'shopbuilder' ), |
| 303 |
'description' => esc_html__( 'Please enter the button text.', 'shopbuilder' ), |
| 304 |
'type' => 'text', |
| 305 |
'label_block' => true, |
| 306 |
'default' => __( 'Secondary Button', 'shopbuilder' ), |
| 307 |
'condition' => $condition2, |
| 308 |
]; |
| 309 |
$fields['sb_button2_link'] = [ |
| 310 |
'type' => 'link', |
| 311 |
'label' => esc_html__( 'Link', 'shopbuilder' ), |
| 312 |
'description' => esc_html__( 'Please enter a button link.', 'shopbuilder' ), |
| 313 |
'placeholder' => esc_html__( 'https://custom-link.com', 'shopbuilder' ), |
| 314 |
'options' => [ 'url', 'is_external', 'nofollow' ], |
| 315 |
'condition' => $condition2, |
| 316 |
]; |
| 317 |
$fields['cta_button_sec_end'] = $obj->end_section(); |
| 318 |
|
| 319 |
return $fields; |
| 320 |
} |
| 321 |
/** |
| 322 |
* Content Parallax Effect |
| 323 |
* |
| 324 |
* @param object $obj Reference object. |
| 325 |
* |
| 326 |
* @return array |
| 327 |
*/ |
| 328 |
private static function cta_parallax_effect( $obj ) { |
| 329 |
$condition = [ 'parallax_effect' => [ 'yes' ] ]; |
| 330 |
$fields['cta_content_parallax_sec_start'] = $obj->start_section( |
| 331 |
esc_html__( 'Parallax', 'shopbuilder' ), |
| 332 |
'content' |
| 333 |
); |
| 334 |
$fields['parallax_effect'] = [ |
| 335 |
'label' => esc_html__( 'Enable Background Parallax Effect?', 'shopbuilder' ), |
| 336 |
'description' => esc_html__( 'Switch on to enable background image parallax effect.', 'shopbuilder' ), |
| 337 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 338 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 339 |
'type' => 'switch', |
| 340 |
]; |
| 341 |
$fields['parallax_speed'] = [ |
| 342 |
'label' => esc_html__( 'Speed', 'shopbuilder' ), |
| 343 |
'type' => 'number', |
| 344 |
'description' => esc_html__( 'Please enter the parallax speed.', 'shopbuilder' ), |
| 345 |
'min' => 0.1, |
| 346 |
'max' => 5, |
| 347 |
'step' => 0.1, |
| 348 |
'default' => 0.5, |
| 349 |
'condition' => $condition, |
| 350 |
]; |
| 351 |
$fields['parallax_effect_note'] = [ |
| 352 |
'type' => 'html', |
| 353 |
'raw' => sprintf( |
| 354 |
'<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a;border: 1px solid #bd3a3a;">%s</span>', |
| 355 |
__( 'The parallax effect is only available when a background image is uploaded. <br /><br />Please ensure a background image is selected to enable this feature.', 'shopbuilder' ) |
| 356 |
), |
| 357 |
'condition' => $condition, |
| 358 |
]; |
| 359 |
$fields['container_width'] = [ |
| 360 |
'type' => 'slider', |
| 361 |
'mode' => 'responsive', |
| 362 |
'label' => esc_html__( 'Container Width', 'shopbuilder' ), |
| 363 |
'size_units' => [ 'px','%' ], |
| 364 |
'range' => [ |
| 365 |
'px' => [ |
| 366 |
'min' => 0, |
| 367 |
'max' => 1920, |
| 368 |
], |
| 369 |
'%' => [ |
| 370 |
'min' => 0, |
| 371 |
'max' => 100, |
| 372 |
], |
| 373 |
], |
| 374 |
'selectors' => [ |
| 375 |
$obj->selectors['content_box_style']['container_width'] => 'max-width:{{SIZE}}{{UNIT}};margin:0 auto;', |
| 376 |
], |
| 377 |
'condition' => $condition, |
| 378 |
]; |
| 379 |
$fields['cta_content_sec_parallax_end'] = $obj->end_section(); |
| 380 |
|
| 381 |
return $fields; |
| 382 |
} |
| 383 |
/** |
| 384 |
* Content Image |
| 385 |
* |
| 386 |
* @param object $obj Reference object. |
| 387 |
* |
| 388 |
* @return array |
| 389 |
*/ |
| 390 |
private static function cta_image( $obj ) { |
| 391 |
$condition = [ |
| 392 |
'layout_style' => [ 'rtsb-cta-layout3' ], |
| 393 |
]; |
| 394 |
$fields['cta_content_image_sec_start'] = $obj->start_section( |
| 395 |
esc_html__( 'Image', 'shopbuilder' ), |
| 396 |
'content', |
| 397 |
[], |
| 398 |
$condition |
| 399 |
); |
| 400 |
$fields['cta_image'] = [ |
| 401 |
'type' => 'media', |
| 402 |
'label' => esc_html__( 'Upload Image', 'shopbuilder' ), |
| 403 |
'default' => [ |
| 404 |
'url' => \Elementor\Utils::get_placeholder_image_src(), |
| 405 |
], |
| 406 |
]; |
| 407 |
$fields['cta_image_size'] = [ |
| 408 |
'type' => 'select2', |
| 409 |
'label' => esc_html__( 'Select Image Size', 'shopbuilder' ), |
| 410 |
'description' => esc_html__( 'Please select the image size.', 'shopbuilder' ), |
| 411 |
'options' => Fns::get_image_sizes(), |
| 412 |
'default' => 'full', |
| 413 |
'label_block' => true, |
| 414 |
'content_classes' => 'elementor-descriptor', |
| 415 |
]; |
| 416 |
$fields['cta_img_dimension'] = [ |
| 417 |
'type' => 'image-dimensions', |
| 418 |
'label' => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ), |
| 419 |
'label_block' => true, |
| 420 |
'show_label' => true, |
| 421 |
'default' => [ |
| 422 |
'width' => 400, |
| 423 |
'height' => 400, |
| 424 |
], |
| 425 |
'conditions' => [ |
| 426 |
'relation' => 'and', |
| 427 |
'terms' => [ |
| 428 |
[ |
| 429 |
'name' => 'cta_image_size', |
| 430 |
'operator' => '==', |
| 431 |
'value' => 'rtsb_custom', |
| 432 |
], |
| 433 |
], |
| 434 |
], |
| 435 |
]; |
| 436 |
$fields['cta_img_crop'] = [ |
| 437 |
'type' => 'select2', |
| 438 |
'label' => esc_html__( 'Image Crop', 'shopbuilder' ), |
| 439 |
'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ), |
| 440 |
'options' => [ |
| 441 |
'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ), |
| 442 |
'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ), |
| 443 |
], |
| 444 |
'default' => 'hard', |
| 445 |
'conditions' => [ |
| 446 |
'relation' => 'and', |
| 447 |
'terms' => [ |
| 448 |
[ |
| 449 |
'name' => 'cta_image_size', |
| 450 |
'operator' => '==', |
| 451 |
'value' => 'rtsb_custom', |
| 452 |
], |
| 453 |
], |
| 454 |
], |
| 455 |
]; |
| 456 |
|
| 457 |
$fields['cta-img_custom_dimension_note'] = [ |
| 458 |
'type' => 'html', |
| 459 |
'raw' => sprintf( |
| 460 |
'<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a;border: 1px solid #bd3a3a;">%s</span>', |
| 461 |
esc_html__( 'Please note that, if you enter image size larger than the actual image itself, the image sizes will fallback to the full image dimension.', 'shopbuilder' ) |
| 462 |
), |
| 463 |
'conditions' => [ |
| 464 |
'relation' => 'and', |
| 465 |
'terms' => [ |
| 466 |
[ |
| 467 |
'name' => 'cta_image_size', |
| 468 |
'operator' => '==', |
| 469 |
'value' => 'rtsb_custom', |
| 470 |
], |
| 471 |
], |
| 472 |
], |
| 473 |
|
| 474 |
]; |
| 475 |
$fields['cta_img_linkable'] = [ |
| 476 |
'type' => 'switch', |
| 477 |
'label' => esc_html__( 'Enable Image Linkable?', 'shopbuilder' ), |
| 478 |
'description' => esc_html__( 'Switch on to enable image linking.', 'shopbuilder' ), |
| 479 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 480 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 481 |
'separator' => 'before', |
| 482 |
]; |
| 483 |
$fields['cta_img_link'] = [ |
| 484 |
'type' => 'link', |
| 485 |
'label' => esc_html__( 'Image Link', 'shopbuilder' ), |
| 486 |
'description' => esc_html__( 'Please enter an alternate custom link.', 'shopbuilder' ), |
| 487 |
'placeholder' => esc_html__( 'https://custom-link.com', 'shopbuilder' ), |
| 488 |
'options' => [ 'url', 'is_external', 'nofollow' ], |
| 489 |
'condition' => [ |
| 490 |
'cta_img_linkable' => [ 'yes' ], |
| 491 |
], |
| 492 |
]; |
| 493 |
$fields['cta_content_sec_image_end'] = $obj->end_section(); |
| 494 |
|
| 495 |
return $fields; |
| 496 |
} |
| 497 |
/** |
| 498 |
* Title style section |
| 499 |
* |
| 500 |
* @param object $obj Reference object. |
| 501 |
* |
| 502 |
* @return array |
| 503 |
*/ |
| 504 |
private static function title_style( $obj ) { |
| 505 |
$css_selectors = $obj->selectors['title_style']; |
| 506 |
$title = esc_html__( 'Title Style', 'shopbuilder' ); |
| 507 |
$selectors = [ |
| 508 |
'typography' => $css_selectors['typography'], |
| 509 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 510 |
'border' => $css_selectors['border'], |
| 511 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 512 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ], |
| 513 |
]; |
| 514 |
|
| 515 |
$fields = ControlHelper::general_elementor_style( 'cta_title_style', $title, $obj, [], $selectors ); |
| 516 |
|
| 517 |
unset( |
| 518 |
$fields['cta_title_style_alignment'], |
| 519 |
$fields['cta_title_style_color_tabs'], |
| 520 |
$fields['cta_title_style_color_tab'], |
| 521 |
$fields['cta_title_style_bg_color'], |
| 522 |
$fields['cta_title_style_color_tab_end'], |
| 523 |
$fields['cta_title_style_hover_color_tab'], |
| 524 |
$fields['cta_title_style_hover_color'], |
| 525 |
$fields['cta_title_style_hover_bg_color'], |
| 526 |
$fields['cta_title_style_hover_color_tab_end'], |
| 527 |
$fields['cta_title_style_color_tabs_end'], |
| 528 |
$fields['cta_title_style_border_hover_color'] |
| 529 |
); |
| 530 |
return $fields; |
| 531 |
} |
| 532 |
/** |
| 533 |
* Content Box style section |
| 534 |
* |
| 535 |
* @param object $obj Reference object. |
| 536 |
* |
| 537 |
* @return array |
| 538 |
*/ |
| 539 |
private static function image_style( $obj ) { |
| 540 |
$condition = [ |
| 541 |
'layout_style' => [ 'rtsb-cta-layout3' ], |
| 542 |
]; |
| 543 |
$css_selectors = $obj->selectors['image_style']; |
| 544 |
$title = esc_html__( 'Image Style', 'shopbuilder' ); |
| 545 |
$selectors = [ |
| 546 |
'box_shadow' => $css_selectors['box_shadow'], |
| 547 |
'border' => $css_selectors['border'], |
| 548 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 549 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 550 |
'image_width' => [ $css_selectors['image_width'] => 'width: {{SIZE}}{{UNIT}};flex: 0 0 {{SIZE}}{{UNIT}};' ], |
| 551 |
'image_max_width' => [ $css_selectors['image_max_width'] => 'max-width: {{SIZE}}{{UNIT}};' ], |
| 552 |
]; |
| 553 |
|
| 554 |
$fields = ControlHelper::general_elementor_style( 'cta_image_style', $title, $obj, $condition, $selectors ); |
| 555 |
|
| 556 |
unset( |
| 557 |
$fields['cta_image_style_typo_note'], |
| 558 |
$fields['rtsb_el_cta_image_style_typography'], |
| 559 |
$fields['cta_image_style_color'], |
| 560 |
$fields['cta_image_style_bg_color'], |
| 561 |
$fields['cta_image_style_alignment'], |
| 562 |
$fields['cta_image_style_color_tabs'], |
| 563 |
$fields['cta_image_style_color_tab'], |
| 564 |
$fields['cta_image_style_color_tab_end'], |
| 565 |
$fields['cta_image_style_hover_color_tab'], |
| 566 |
$fields['cta_image_style_hover_color'], |
| 567 |
$fields['cta_image_style_hover_bg_color'], |
| 568 |
$fields['cta_image_style_hover_color_tab_end'], |
| 569 |
$fields['cta_image_style_color_tabs_end'], |
| 570 |
$fields['cta_image_style_border_hover_color'], |
| 571 |
$fields['cta_image_style_padding'] |
| 572 |
); |
| 573 |
$fields['cta_image_style_border_note']['separator'] = 'default'; |
| 574 |
$fields['cta_image_style_color_note']['separator'] = 'default'; |
| 575 |
$extra_controls['cta_image_style_border_radius'] = [ |
| 576 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 577 |
'type' => 'dimensions', |
| 578 |
'mode' => 'responsive', |
| 579 |
'size_units' => [ 'px' ], |
| 580 |
'selectors' => $selectors['border_radius'], |
| 581 |
]; |
| 582 |
$fields = Fns::insert_controls( 'cta_image_style_spacing_note', $fields, $extra_controls ); |
| 583 |
$extra_controls2['cta_image_style_box_shadow'] = [ |
| 584 |
'type' => 'box-shadow', |
| 585 |
'mode' => 'group', |
| 586 |
'label' => esc_html__( 'Box Shadow', 'shopbuilder' ), |
| 587 |
'selector' => $selectors['box_shadow'], |
| 588 |
]; |
| 589 |
$fields = Fns::insert_controls( 'cta_image_style_color_note', $fields, $extra_controls2, true ); |
| 590 |
|
| 591 |
$extra_controls3['image_width_heading'] = $obj->el_heading( esc_html__( 'Dimension', 'shopbuilder' ), 'default' ); |
| 592 |
$extra_controls3['image_styles_width'] = [ |
| 593 |
'type' => 'slider', |
| 594 |
'mode' => 'responsive', |
| 595 |
'label' => esc_html__( 'Image Width', 'shopbuilder' ), |
| 596 |
'size_units' => [ '%', 'px' ], |
| 597 |
'range' => [ |
| 598 |
'%' => [ |
| 599 |
'min' => 0, |
| 600 |
'max' => 100, |
| 601 |
'step' => 1, |
| 602 |
], |
| 603 |
'px' => [ |
| 604 |
'min' => 0, |
| 605 |
'max' => 600, |
| 606 |
'step' => 1, |
| 607 |
], |
| 608 |
], |
| 609 |
'selectors' => $selectors['image_width'], |
| 610 |
|
| 611 |
]; |
| 612 |
$extra_controls3['image_styles_max_width'] = [ |
| 613 |
'type' => 'slider', |
| 614 |
'mode' => 'responsive', |
| 615 |
'label' => esc_html__( 'Image Max-Width', 'shopbuilder' ), |
| 616 |
'size_units' => [ '%', 'px' ], |
| 617 |
'range' => [ |
| 618 |
'%' => [ |
| 619 |
'min' => 0, |
| 620 |
'max' => 100, |
| 621 |
'step' => 1, |
| 622 |
], |
| 623 |
'px' => [ |
| 624 |
'min' => 0, |
| 625 |
'max' => 600, |
| 626 |
'step' => 1, |
| 627 |
], |
| 628 |
|
| 629 |
], |
| 630 |
'selectors' => $selectors['image_max_width'], |
| 631 |
]; |
| 632 |
$fields = Fns::insert_controls( 'cta_image_style_color_note', $fields, $extra_controls3 ); |
| 633 |
return $fields; |
| 634 |
} |
| 635 |
/** |
| 636 |
* Content Box style section |
| 637 |
* |
| 638 |
* @param object $obj Reference object. |
| 639 |
* |
| 640 |
* @return array |
| 641 |
*/ |
| 642 |
private static function content_box_style( $obj ) { |
| 643 |
$css_selectors = $obj->selectors['content_box_style']; |
| 644 |
$title = esc_html__( 'Content Box Style', 'shopbuilder' ); |
| 645 |
$selectors = [ |
| 646 |
'box_shadow' => $css_selectors['box_shadow'], |
| 647 |
'gradient_bg' => $css_selectors['gradient_bg'], |
| 648 |
'bg_overlay' => $css_selectors['bg_overlay'], |
| 649 |
'border' => $css_selectors['border'], |
| 650 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 651 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 652 |
]; |
| 653 |
|
| 654 |
$fields = ControlHelper::general_elementor_style( 'cta_content_box_style', $title, $obj, [], $selectors ); |
| 655 |
|
| 656 |
unset( |
| 657 |
$fields['cta_content_box_style_typo_note'], |
| 658 |
$fields['rtsb_el_cta_content_box_style_typography'], |
| 659 |
$fields['cta_content_box_style_color'], |
| 660 |
$fields['cta_content_box_style_bg_color'], |
| 661 |
$fields['cta_content_box_style_alignment'], |
| 662 |
$fields['cta_content_box_style_color_tabs'], |
| 663 |
$fields['cta_content_box_style_color_tab'], |
| 664 |
$fields['cta_content_box_style_color_tab_end'], |
| 665 |
$fields['cta_content_box_style_hover_color_tab'], |
| 666 |
$fields['cta_content_box_style_hover_color'], |
| 667 |
$fields['cta_content_box_style_hover_bg_color'], |
| 668 |
$fields['cta_content_box_style_hover_color_tab_end'], |
| 669 |
$fields['cta_content_box_style_color_tabs_end'], |
| 670 |
$fields['cta_content_box_style_border_hover_color'], |
| 671 |
$fields['cta_content_box_style_margin'] |
| 672 |
); |
| 673 |
$fields['cta_content_box_style_border_note']['separator'] = 'default'; |
| 674 |
$fields['cta_content_box_style_color_note']['separator'] = 'default'; |
| 675 |
$extra_controls['cta_content_box_style_border_radius'] = [ |
| 676 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 677 |
'type' => 'dimensions', |
| 678 |
'mode' => 'responsive', |
| 679 |
'size_units' => [ 'px' ], |
| 680 |
'selectors' => $selectors['border_radius'], |
| 681 |
]; |
| 682 |
$fields = Fns::insert_controls( 'cta_content_box_style_spacing_note', $fields, $extra_controls ); |
| 683 |
$extra_controls2['cta_content_box_style_gradient_bg'] = [ |
| 684 |
'label' => esc_html__( 'Background', 'shopbuilder' ), |
| 685 |
'type' => 'background', |
| 686 |
'mode' => 'group', |
| 687 |
'selector' => $selectors['gradient_bg'], |
| 688 |
]; |
| 689 |
$extra_controls2['cta_content_box_style_bg_overlay'] = [ |
| 690 |
'label' => esc_html__( 'Background Overlay', 'shopbuilder' ), |
| 691 |
'type' => 'background', |
| 692 |
'mode' => 'group', |
| 693 |
'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 694 |
'selector' => $selectors['bg_overlay'], |
| 695 |
'fields_options' => [ |
| 696 |
'background' => [ |
| 697 |
'label' => esc_html__( 'Overlay Background Type', 'shopbuilder' ), |
| 698 |
], |
| 699 |
], |
| 700 |
]; |
| 701 |
$extra_controls2['cta_content_box_style_box_shadow'] = [ |
| 702 |
'type' => 'box-shadow', |
| 703 |
'mode' => 'group', |
| 704 |
'label' => esc_html__( 'Box Shadow', 'shopbuilder' ), |
| 705 |
'selector' => $selectors['box_shadow'], |
| 706 |
]; |
| 707 |
$fields = Fns::insert_controls( 'cta_content_box_style_color_note', $fields, $extra_controls2, true ); |
| 708 |
|
| 709 |
return $fields; |
| 710 |
} |
| 711 |
/** |
| 712 |
* Content style section |
| 713 |
* |
| 714 |
* @param object $obj Reference object. |
| 715 |
* |
| 716 |
* @return array |
| 717 |
*/ |
| 718 |
private static function content_style( $obj ) { |
| 719 |
$condition = [ |
| 720 |
'display_content' => 'yes', |
| 721 |
]; |
| 722 |
$css_selectors = $obj->selectors['content_style']; |
| 723 |
$title = esc_html__( 'Description Style', 'shopbuilder' ); |
| 724 |
$selectors = [ |
| 725 |
'typography' => $css_selectors['typography'], |
| 726 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 727 |
'border' => $css_selectors['border'], |
| 728 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 729 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 730 |
]; |
| 731 |
|
| 732 |
$fields = ControlHelper::general_elementor_style( 'cta_content_style', $title, $obj, $condition, $selectors ); |
| 733 |
|
| 734 |
unset( |
| 735 |
$fields['cta_content_style_alignment'], |
| 736 |
$fields['cta_content_style_color_tabs'], |
| 737 |
$fields['cta_content_style_color_tab'], |
| 738 |
$fields['cta_content_style_bg_color'], |
| 739 |
$fields['cta_content_style_color_tab_end'], |
| 740 |
$fields['cta_content_style_hover_color_tab'], |
| 741 |
$fields['cta_content_style_hover_color'], |
| 742 |
$fields['cta_content_style_hover_bg_color'], |
| 743 |
$fields['cta_content_style_hover_color_tab_end'], |
| 744 |
$fields['cta_content_style_color_tabs_end'], |
| 745 |
$fields['cta_content_style_border_hover_color'] |
| 746 |
); |
| 747 |
|
| 748 |
return $fields; |
| 749 |
} |
| 750 |
/** |
| 751 |
* Button style section |
| 752 |
* |
| 753 |
* @param object $obj Reference object. |
| 754 |
* |
| 755 |
* @return array |
| 756 |
*/ |
| 757 |
private static function button_style( $obj, $type = 'primary' ) { |
| 758 |
$condition = [ |
| 759 |
'display_button' => 'yes', |
| 760 |
]; |
| 761 |
|
| 762 |
if ( 'secondary' === $type ) { |
| 763 |
$condition = [ |
| 764 |
'display_button' => 'yes', |
| 765 |
'display_button2' => 'yes', |
| 766 |
]; |
| 767 |
} |
| 768 |
$css_selectors = $obj->selectors[ $type . '_button_style' ]; |
| 769 |
$title = sprintf( |
| 770 |
// Translators: %s is replaced with the button type, e.g., "Primary", "Secondary", etc. |
| 771 |
esc_html__( '%s Button Style', 'shopbuilder' ), |
| 772 |
ucfirst( $type ) |
| 773 |
); |
| 774 |
$selectors = [ |
| 775 |
'typography' => $css_selectors['typography'], |
| 776 |
'icon_size' => [ |
| 777 |
$css_selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}};', |
| 778 |
$css_selectors['icon_size']['svg'] => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};', |
| 779 |
], |
| 780 |
'icon_gap' => [ $css_selectors['icon_gap'] => 'gap: {{SIZE}}{{UNIT}};' ], |
| 781 |
'btn_width' => [ $css_selectors['btn_width'] => 'min-width: {{SIZE}}{{UNIT}};' ], |
| 782 |
'btn_height' => [ $css_selectors['btn_height'] => 'height: {{SIZE}}{{UNIT}};' ], |
| 783 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 784 |
'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], |
| 785 |
'gradient_bg' => $css_selectors['gradient_bg'], |
| 786 |
'hover_gradient_bg' => $css_selectors['hover_gradient_bg'], |
| 787 |
'border' => $css_selectors['border'], |
| 788 |
'box_shadow' => $css_selectors['box_shadow'], |
| 789 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 790 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 791 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 792 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 793 |
]; |
| 794 |
|
| 795 |
$fields = ControlHelper::general_elementor_style( 'sb_' . $type . '_button_style', $title, $obj, $condition, $selectors ); |
| 796 |
unset( |
| 797 |
$fields[ 'sb_' . $type . '_button_style_bg_color' ], |
| 798 |
$fields[ 'sb_' . $type . '_button_style_alignment' ], |
| 799 |
$fields[ 'sb_' . $type . '_button_style_hover_bg_color' ], |
| 800 |
); |
| 801 |
$extra_controls[ 'sb_' . $type . '_button_style_border_radius' ] = [ |
| 802 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 803 |
'type' => 'dimensions', |
| 804 |
'mode' => 'responsive', |
| 805 |
'size_units' => [ 'px' ], |
| 806 |
'selectors' => $selectors['border_radius'], |
| 807 |
]; |
| 808 |
$fields = Fns::insert_controls( 'sb_' . $type . '_button_style_spacing_note', $fields, $extra_controls ); |
| 809 |
$extra_controls2[ 'sb_' . $type . '_button_style_btn_width' ] = [ |
| 810 |
'type' => 'slider', |
| 811 |
'mode' => 'responsive', |
| 812 |
'label' => esc_html__( 'Button Width', 'shopbuilder' ), |
| 813 |
'size_units' => [ 'px','%' ], |
| 814 |
'range' => [ |
| 815 |
'px' => [ |
| 816 |
'min' => 10, |
| 817 |
'max' => 1000, |
| 818 |
], |
| 819 |
'%' => [ |
| 820 |
'min' => 0, |
| 821 |
'max' => 100, |
| 822 |
], |
| 823 |
], |
| 824 |
'selectors' => $selectors['btn_width'], |
| 825 |
]; |
| 826 |
$extra_controls2[ 'sb_' . $type . '_button_style_btn_height' ] = [ |
| 827 |
'type' => 'slider', |
| 828 |
'mode' => 'responsive', |
| 829 |
'label' => esc_html__( 'Button Height', 'shopbuilder' ), |
| 830 |
'size_units' => [ 'px','%' ], |
| 831 |
'range' => [ |
| 832 |
'px' => [ |
| 833 |
'min' => 10, |
| 834 |
'max' => 1000, |
| 835 |
], |
| 836 |
'%' => [ |
| 837 |
'min' => 0, |
| 838 |
'max' => 100, |
| 839 |
], |
| 840 |
], |
| 841 |
'selectors' => $selectors['btn_height'], |
| 842 |
]; |
| 843 |
|
| 844 |
$extra_controls2[ 'sb_' . $type . '_button_style_icon_size' ] = [ |
| 845 |
'type' => 'slider', |
| 846 |
'mode' => 'responsive', |
| 847 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 848 |
'size_units' => [ 'px' ], |
| 849 |
'range' => [ |
| 850 |
'px' => [ |
| 851 |
'min' => 0, |
| 852 |
'max' => 100, |
| 853 |
], |
| 854 |
], |
| 855 |
'selectors' => $selectors['icon_size'], |
| 856 |
]; |
| 857 |
$extra_controls2[ 'sb_' . $type . '_button_style_icon_gap' ] = [ |
| 858 |
'type' => 'slider', |
| 859 |
'mode' => 'responsive', |
| 860 |
'label' => esc_html__( 'Icon Gap', 'shopbuilder' ), |
| 861 |
'size_units' => [ 'px' ], |
| 862 |
'range' => [ |
| 863 |
'px' => [ |
| 864 |
'min' => 0, |
| 865 |
'max' => 100, |
| 866 |
], |
| 867 |
], |
| 868 |
'selectors' => $selectors['icon_gap'], |
| 869 |
]; |
| 870 |
$extra_controls2[ 'sb_' . $type . '_button_style_box_shadow' ] = [ |
| 871 |
'type' => 'box-shadow', |
| 872 |
'mode' => 'group', |
| 873 |
'label' => esc_html__( 'Box Shadow', 'shopbuilder' ), |
| 874 |
'selector' => $selectors['box_shadow'], |
| 875 |
]; |
| 876 |
$fields = Fns::insert_controls( 'sb_' . $type . '_button_style_spacing_note', $fields, $extra_controls2, true ); |
| 877 |
|
| 878 |
$extra_controls3[ 'sb_' . $type . '_button_style_gradient_bg' ] = [ |
| 879 |
'label' => esc_html__( 'Background', 'shopbuilder' ), |
| 880 |
'type' => 'background', |
| 881 |
'mode' => 'group', |
| 882 |
'selector' => $selectors['gradient_bg'], |
| 883 |
]; |
| 884 |
$fields = Fns::insert_controls( 'sb_' . $type . '_button_style_color', $fields, $extra_controls3, true ); |
| 885 |
|
| 886 |
$extra_controls4[ 'sb_' . $type . '_button_style_hover_gradient_bg' ] = [ |
| 887 |
'label' => esc_html__( 'Hover Background', 'shopbuilder' ), |
| 888 |
'type' => 'background', |
| 889 |
'mode' => 'group', |
| 890 |
'selector' => $selectors['hover_gradient_bg'], |
| 891 |
]; |
| 892 |
$fields = Fns::insert_controls( 'sb_' . $type . '_button_style_hover_color', $fields, $extra_controls4, true ); |
| 893 |
|
| 894 |
return $fields; |
| 895 |
} |
| 896 |
} |
| 897 |
|