| 1 |
<?php |
| 2 |
/** |
| 3 |
* Controls class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\General\Counter; |
| 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::counter_count( $obj ), |
| 35 |
self::counter_icon( $obj ), |
| 36 |
self::counter_title( $obj ), |
| 37 |
); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Style section |
| 42 |
* |
| 43 |
* @param object $obj Reference object. |
| 44 |
* |
| 45 |
* @return array |
| 46 |
*/ |
| 47 |
public static function style( $obj ) { |
| 48 |
return array_merge( |
| 49 |
self::content_box_style( $obj ), |
| 50 |
self::icon_box_style( $obj ), |
| 51 |
self::counter_count_style( $obj ), |
| 52 |
self::title_style( $obj ), |
| 53 |
); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Preset section |
| 58 |
* |
| 59 |
* @param object $obj Reference object. |
| 60 |
* |
| 61 |
* @return array |
| 62 |
*/ |
| 63 |
private static function preset( $obj ) { |
| 64 |
$alignment_options = ControlHelper::alignment(); |
| 65 |
unset( $alignment_options['justify'] ); |
| 66 |
$fields['counter_preset'] = $obj->start_section( |
| 67 |
esc_html__( 'Layout', 'shopbuilder' ), |
| 68 |
'content' |
| 69 |
); |
| 70 |
$fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) ); |
| 71 |
$fields['layout_style'] = [ |
| 72 |
'type' => 'rtsb-image-selector', |
| 73 |
'options' => ControlHelper::general_widgets_counter_layouts(), |
| 74 |
'default' => 'rtsb-counter-layout1', |
| 75 |
]; |
| 76 |
$fields['counter_element_alignment'] = [ |
| 77 |
'mode' => 'responsive', |
| 78 |
'type' => 'choose', |
| 79 |
'label' => esc_html__( 'Element Alignment', 'shopbuilder' ), |
| 80 |
'options' => $alignment_options, |
| 81 |
'separator' => 'before', |
| 82 |
'selectors' => [ $obj->selectors['layout']['alignment'] => 'text-align: {{VALUE}};justify-content: {{VALUE}};' ], |
| 83 |
]; |
| 84 |
$fields['counter_preset_end'] = $obj->end_section(); |
| 85 |
return $fields; |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* Title section |
| 90 |
* |
| 91 |
* @param object $obj Reference object. |
| 92 |
* |
| 93 |
* @return array |
| 94 |
*/ |
| 95 |
private static function counter_title( $obj ) { |
| 96 |
$fields['counter_title_sec_start'] = $obj->start_section( |
| 97 |
esc_html__( 'Title', 'shopbuilder' ), |
| 98 |
'content' |
| 99 |
); |
| 100 |
$fields['counter_title_html_tag'] = [ |
| 101 |
'label' => esc_html__( 'Title Tag', 'shopbuilder' ), |
| 102 |
'description' => esc_html__( 'Please select the title tag.', 'shopbuilder' ), |
| 103 |
'type' => 'select', |
| 104 |
'options' => ControlHelper::heading_tags(), |
| 105 |
'default' => 'h2', |
| 106 |
'label_block' => true, |
| 107 |
]; |
| 108 |
$fields['counter_title'] = [ |
| 109 |
'label' => esc_html__( 'Title', 'shopbuilder' ), |
| 110 |
'description' => esc_html__( 'Please enter title text.', 'shopbuilder' ), |
| 111 |
'type' => 'textarea', |
| 112 |
'label_block' => true, |
| 113 |
'default' => __( 'Happy Customers', 'shopbuilder' ), |
| 114 |
]; |
| 115 |
|
| 116 |
$fields['counter_title_sec_end'] = $obj->end_section(); |
| 117 |
|
| 118 |
return $fields; |
| 119 |
} |
| 120 |
|
| 121 |
/** |
| 122 |
* Count section |
| 123 |
* |
| 124 |
* @param object $obj Reference object. |
| 125 |
* |
| 126 |
* @return array |
| 127 |
*/ |
| 128 |
private static function counter_count( $obj ) { |
| 129 |
$fields['counter_count_sec_start'] = $obj->start_section( |
| 130 |
esc_html__( 'Count', 'shopbuilder' ), |
| 131 |
'content', |
| 132 |
[], |
| 133 |
); |
| 134 |
$fields['counter_count'] = [ |
| 135 |
'label' => esc_html__( 'Count Number', 'shopbuilder' ), |
| 136 |
'description' => esc_html__( 'Please enter the count number.', 'shopbuilder' ), |
| 137 |
'type' => 'number', |
| 138 |
'default' => '1000', |
| 139 |
]; |
| 140 |
$fields['counter_transition'] = [ |
| 141 |
'label' => esc_html__( 'Animation Duration', 'shopbuilder' ), |
| 142 |
'description' => esc_html__( 'This time calculate with milliseconds.', 'shopbuilder' ), |
| 143 |
'type' => 'number', |
| 144 |
'default' => '2000', |
| 145 |
]; |
| 146 |
$fields['display_prefix'] = [ |
| 147 |
'label' => esc_html__( 'Prefix', 'shopbuilder' ), |
| 148 |
'description' => esc_html__( 'Switch on to show prefix.', 'shopbuilder' ), |
| 149 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 150 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 151 |
'type' => 'switch', |
| 152 |
]; |
| 153 |
$fields['count_prefix'] = [ |
| 154 |
'label' => esc_html__( 'Number Prefix', 'shopbuilder' ), |
| 155 |
'type' => 'text', |
| 156 |
'default' => '+', |
| 157 |
'label_block' => true, |
| 158 |
'condition' => [ |
| 159 |
'display_prefix' => 'yes', |
| 160 |
], |
| 161 |
]; |
| 162 |
$fields['display_suffix'] = [ |
| 163 |
'label' => esc_html__( 'Suffix', 'shopbuilder' ), |
| 164 |
'description' => esc_html__( 'Switch on to show suffix.', 'shopbuilder' ), |
| 165 |
'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 166 |
'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 167 |
'type' => 'switch', |
| 168 |
]; |
| 169 |
$fields['count_suffix'] = [ |
| 170 |
'label' => esc_html__( 'Number Suffix', 'shopbuilder' ), |
| 171 |
'type' => 'text', |
| 172 |
'default' => '+', |
| 173 |
'label_block' => true, |
| 174 |
'condition' => [ |
| 175 |
'display_suffix' => 'yes', |
| 176 |
], |
| 177 |
]; |
| 178 |
$fields['counter_count_sec_end'] = $obj->end_section(); |
| 179 |
|
| 180 |
return $fields; |
| 181 |
} |
| 182 |
|
| 183 |
/** |
| 184 |
* Content Icon |
| 185 |
* |
| 186 |
* @param object $obj Reference object. |
| 187 |
* |
| 188 |
* @return array |
| 189 |
*/ |
| 190 |
public static function counter_icon( $obj ) { |
| 191 |
$fields['counter_content_icon_sec_start'] = $obj->start_section( |
| 192 |
esc_html__( 'Icon', 'shopbuilder' ), |
| 193 |
'content', |
| 194 |
[], |
| 195 |
); |
| 196 |
$fields['counter_icon_type'] = [ |
| 197 |
'label' => __( 'Icon Type', 'shopbuilder' ), |
| 198 |
'type' => 'select', |
| 199 |
'default' => 'icon', |
| 200 |
'options' => [ |
| 201 |
'icon' => __( 'Icon', 'shopbuilder' ), |
| 202 |
'image' => __( 'Image', 'shopbuilder' ), |
| 203 |
], |
| 204 |
]; |
| 205 |
$fields['counter_icon'] = [ |
| 206 |
'label' => esc_html__( 'Icon', 'shopbuilder' ), |
| 207 |
'type' => 'icons', |
| 208 |
'default' => [ |
| 209 |
'value' => 'far fa-smile', |
| 210 |
'library' => 'fa-solid', |
| 211 |
], |
| 212 |
'condition' => [ |
| 213 |
'counter_icon_type' => [ 'icon' ], |
| 214 |
], |
| 215 |
]; |
| 216 |
$fields['counter_image'] = [ |
| 217 |
'type' => 'media', |
| 218 |
'label' => esc_html__( 'Upload Image', 'shopbuilder' ), |
| 219 |
'default' => [ |
| 220 |
'url' => \Elementor\Utils::get_placeholder_image_src(), |
| 221 |
], |
| 222 |
'condition' => [ |
| 223 |
'counter_icon_type' => [ 'image' ], |
| 224 |
], |
| 225 |
]; |
| 226 |
$fields['counter_image_size'] = [ |
| 227 |
'type' => 'select2', |
| 228 |
'label' => esc_html__( 'Select Image Size', 'shopbuilder' ), |
| 229 |
'description' => esc_html__( 'Please select the image size.', 'shopbuilder' ), |
| 230 |
'options' => Fns::get_image_sizes(), |
| 231 |
'default' => 'full', |
| 232 |
'label_block' => true, |
| 233 |
'content_classes' => 'elementor-descriptor', |
| 234 |
'condition' => [ |
| 235 |
'counter_icon_type' => [ 'image' ], |
| 236 |
], |
| 237 |
]; |
| 238 |
$fields['counter_img_dimension'] = [ |
| 239 |
'type' => 'image-dimensions', |
| 240 |
'label' => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ), |
| 241 |
'label_block' => true, |
| 242 |
'show_label' => true, |
| 243 |
'default' => [ |
| 244 |
'width' => 400, |
| 245 |
'height' => 400, |
| 246 |
], |
| 247 |
'conditions' => [ |
| 248 |
'relation' => 'and', |
| 249 |
'terms' => [ |
| 250 |
[ |
| 251 |
'name' => 'counter_image_size', |
| 252 |
'operator' => '==', |
| 253 |
'value' => 'rtsb_custom', |
| 254 |
], |
| 255 |
[ |
| 256 |
'name' => 'counter_icon_type', |
| 257 |
'operator' => '==', |
| 258 |
'value' => 'image', |
| 259 |
], |
| 260 |
], |
| 261 |
], |
| 262 |
]; |
| 263 |
$fields['counter_img_crop'] = [ |
| 264 |
'type' => 'select2', |
| 265 |
'label' => esc_html__( 'Image Crop', 'shopbuilder' ), |
| 266 |
'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ), |
| 267 |
'options' => [ |
| 268 |
'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ), |
| 269 |
'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ), |
| 270 |
], |
| 271 |
'default' => 'hard', |
| 272 |
'condition' => [ |
| 273 |
'counter_icon_type' => [ 'image' ], |
| 274 |
'counter_image_size' => [ 'rtsb_custom' ], |
| 275 |
], |
| 276 |
]; |
| 277 |
|
| 278 |
$fields['counter-img_custom_dimension_note'] = [ |
| 279 |
'type' => 'html', |
| 280 |
'raw' => sprintf( |
| 281 |
'<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a;border: 1px solid #bd3a3a;">%s</span>', |
| 282 |
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' ) |
| 283 |
), |
| 284 |
'condition' => [ |
| 285 |
'counter_icon_type' => [ 'image' ], |
| 286 |
'counter_image_size' => [ 'rtsb_custom' ], |
| 287 |
], |
| 288 |
|
| 289 |
]; |
| 290 |
$fields['counter_icon_position'] = [ |
| 291 |
'mode' => 'responsive', |
| 292 |
'type' => 'choose', |
| 293 |
'separator' => 'before', |
| 294 |
'label' => esc_html__( 'Icon Position', 'shopbuilder' ), |
| 295 |
'options' => [ |
| 296 |
'left' => [ |
| 297 |
'title' => esc_html__( 'Left', 'shopbuilder' ), |
| 298 |
'icon' => 'eicon-h-align-left', |
| 299 |
], |
| 300 |
'top' => [ |
| 301 |
'title' => esc_html__( 'Top', 'shopbuilder' ), |
| 302 |
'icon' => 'eicon-v-align-top', |
| 303 |
], |
| 304 |
'right' => [ |
| 305 |
'title' => esc_html__( 'Right', 'shopbuilder' ), |
| 306 |
'icon' => 'eicon-h-align-right', |
| 307 |
], |
| 308 |
'bottom' => [ |
| 309 |
'title' => esc_html__( 'Bottom', 'shopbuilder' ), |
| 310 |
'icon' => 'eicon-v-align-bottom', |
| 311 |
], |
| 312 |
|
| 313 |
], |
| 314 |
'render_template' => 'true', |
| 315 |
'toggle' => true, |
| 316 |
]; |
| 317 |
$fields['counter_icon_vertical_alignment'] = [ |
| 318 |
'mode' => 'responsive', |
| 319 |
'type' => 'choose', |
| 320 |
'separator' => 'before', |
| 321 |
'label' => esc_html__( 'Icon Vertical Alignment', 'shopbuilder' ), |
| 322 |
'options' => [ |
| 323 |
'start' => [ |
| 324 |
'title' => esc_html__( 'Start', 'shopbuilder' ), |
| 325 |
'icon' => 'eicon-justify-start-v', |
| 326 |
], |
| 327 |
'center' => [ |
| 328 |
'title' => esc_html__( 'Center', 'shopbuilder' ), |
| 329 |
'icon' => 'eicon-justify-center-v', |
| 330 |
], |
| 331 |
'end' => [ |
| 332 |
'title' => esc_html__( 'End', 'shopbuilder' ), |
| 333 |
'icon' => 'eicon-justify-end-v', |
| 334 |
], |
| 335 |
|
| 336 |
], |
| 337 |
'selectors' => [ $obj->selectors['layout']['vertical_alignment'] => 'align-items: {{VALUE}};' ], |
| 338 |
'toggle' => true, |
| 339 |
'condition' => [ |
| 340 |
'counter_icon_position!' => [ 'top','bottom' ], |
| 341 |
], |
| 342 |
]; |
| 343 |
$fields['counter_content_sec_icon_end'] = $obj->end_section(); |
| 344 |
return $fields; |
| 345 |
} |
| 346 |
|
| 347 |
|
| 348 |
/** |
| 349 |
* Title style section |
| 350 |
* |
| 351 |
* @param object $obj Reference object. |
| 352 |
* |
| 353 |
* @return array |
| 354 |
*/ |
| 355 |
private static function title_style( $obj ) { |
| 356 |
$css_selectors = $obj->selectors['title_style']; |
| 357 |
$title = esc_html__( 'Title Style', 'shopbuilder' ); |
| 358 |
$selectors = [ |
| 359 |
'typography' => $css_selectors['typography'], |
| 360 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 361 |
'border' => $css_selectors['border'], |
| 362 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 363 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ], |
| 364 |
]; |
| 365 |
|
| 366 |
$fields = ControlHelper::general_elementor_style( 'counter_title_style', $title, $obj, [], $selectors ); |
| 367 |
|
| 368 |
unset( |
| 369 |
$fields['counter_title_style_alignment'], |
| 370 |
$fields['counter_title_style_color_tabs'], |
| 371 |
$fields['counter_title_style_color_tab'], |
| 372 |
$fields['counter_title_style_bg_color'], |
| 373 |
$fields['counter_title_style_color_tab_end'], |
| 374 |
$fields['counter_title_style_hover_color_tab'], |
| 375 |
$fields['counter_title_style_hover_color'], |
| 376 |
$fields['counter_title_style_hover_bg_color'], |
| 377 |
$fields['counter_title_style_hover_color_tab_end'], |
| 378 |
$fields['counter_title_style_color_tabs_end'], |
| 379 |
$fields['counter_title_style_border_hover_color'] |
| 380 |
); |
| 381 |
return $fields; |
| 382 |
} |
| 383 |
|
| 384 |
/** |
| 385 |
* Content Box style section |
| 386 |
* |
| 387 |
* @param object $obj Reference object. |
| 388 |
* |
| 389 |
* @return array |
| 390 |
*/ |
| 391 |
private static function content_box_style( $obj ) { |
| 392 |
$css_selectors = $obj->selectors['content_box_style']; |
| 393 |
$title = esc_html__( 'Content Box Style', 'shopbuilder' ); |
| 394 |
$selectors = [ |
| 395 |
'box_shadow' => $css_selectors['box_shadow'], |
| 396 |
'gradient_bg' => $css_selectors['gradient_bg'], |
| 397 |
'hover_gradient_bg' => $css_selectors['hover_gradient_bg'], |
| 398 |
'hover_bg_overlay' => $css_selectors['hover_bg_overlay'], |
| 399 |
'hover_box_shadow' => $css_selectors['hover_box_shadow'], |
| 400 |
'bg_overlay' => $css_selectors['bg_overlay'], |
| 401 |
'border' => $css_selectors['border'], |
| 402 |
'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ], |
| 403 |
'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 404 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 405 |
]; |
| 406 |
|
| 407 |
$fields = ControlHelper::general_elementor_style( 'counter_content_box_style', $title, $obj, [], $selectors ); |
| 408 |
|
| 409 |
unset( |
| 410 |
$fields['counter_content_box_style_color'], |
| 411 |
$fields['counter_content_box_style_bg_color'], |
| 412 |
$fields['counter_content_box_style_alignment'], |
| 413 |
$fields['counter_content_box_style_typo_note'], |
| 414 |
$fields['rtsb_el_counter_content_box_style_typography'], |
| 415 |
$fields['counter_content_box_style_hover_color'], |
| 416 |
$fields['counter_content_box_style_hover_bg_color'], |
| 417 |
$fields['counter_content_box_style_hover_color_tab_end'], |
| 418 |
$fields['counter_content_box_style_margin'] |
| 419 |
); |
| 420 |
$fields['counter_content_box_style_border_note']['separator'] = 'default'; |
| 421 |
$fields['counter_content_box_style_color_note']['separator'] = 'default'; |
| 422 |
$extra_controls['counter_content_box_style_border_radius'] = [ |
| 423 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 424 |
'type' => 'dimensions', |
| 425 |
'mode' => 'responsive', |
| 426 |
'size_units' => [ 'px' ], |
| 427 |
'selectors' => $selectors['border_radius'], |
| 428 |
]; |
| 429 |
$fields = Fns::insert_controls( 'counter_content_box_style_spacing_note', $fields, $extra_controls ); |
| 430 |
$extra_controls2['counter_content_box_style_gradient_bg'] = [ |
| 431 |
'label' => esc_html__( 'Background', 'shopbuilder' ), |
| 432 |
'type' => 'background', |
| 433 |
'mode' => 'group', |
| 434 |
'selector' => $selectors['gradient_bg'], |
| 435 |
]; |
| 436 |
$extra_controls2['counter_content_box_style_bg_overlay'] = [ |
| 437 |
'label' => esc_html__( 'Background Overlay', 'shopbuilder' ), |
| 438 |
'type' => 'background', |
| 439 |
'mode' => 'group', |
| 440 |
'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 441 |
'selector' => $selectors['bg_overlay'], |
| 442 |
'fields_options' => [ |
| 443 |
'background' => [ |
| 444 |
'label' => esc_html__( 'Overlay Background Type', 'shopbuilder' ), |
| 445 |
], |
| 446 |
], |
| 447 |
]; |
| 448 |
$extra_controls2['counter_content_box_style_box_shadow'] = [ |
| 449 |
'type' => 'box-shadow', |
| 450 |
'mode' => 'group', |
| 451 |
'label' => esc_html__( 'Box Shadow', 'shopbuilder' ), |
| 452 |
'selector' => $selectors['box_shadow'], |
| 453 |
]; |
| 454 |
$fields = Fns::insert_controls( 'counter_content_box_style_color_tab', $fields, $extra_controls2, true ); |
| 455 |
$extra_controls3['counter_content_box_style_hover_gradient_bg'] = [ |
| 456 |
'label' => esc_html__( 'Background', 'shopbuilder' ), |
| 457 |
'type' => 'background', |
| 458 |
'mode' => 'group', |
| 459 |
'selector' => $selectors['hover_gradient_bg'], |
| 460 |
]; |
| 461 |
$extra_controls3['counter_content_box_style_hover_bg_overlay'] = [ |
| 462 |
'label' => esc_html__( 'Background Overlay', 'shopbuilder' ), |
| 463 |
'type' => 'background', |
| 464 |
'mode' => 'group', |
| 465 |
'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 466 |
'selector' => $selectors['hover_bg_overlay'], |
| 467 |
'fields_options' => [ |
| 468 |
'background' => [ |
| 469 |
'label' => esc_html__( 'Overlay Background Type', 'shopbuilder' ), |
| 470 |
], |
| 471 |
], |
| 472 |
]; |
| 473 |
$extra_controls3['counter_content_box_style_hover_box_shadow'] = [ |
| 474 |
'type' => 'box-shadow', |
| 475 |
'mode' => 'group', |
| 476 |
'label' => esc_html__( 'Box Shadow', 'shopbuilder' ), |
| 477 |
'selector' => $selectors['hover_box_shadow'], |
| 478 |
]; |
| 479 |
$fields = Fns::insert_controls( 'counter_content_box_style_hover_color_tab', $fields, $extra_controls3, true ); |
| 480 |
|
| 481 |
return $fields; |
| 482 |
} |
| 483 |
|
| 484 |
/** |
| 485 |
* Icon style section |
| 486 |
* |
| 487 |
* @param object $obj Reference object. |
| 488 |
* |
| 489 |
* @return array |
| 490 |
*/ |
| 491 |
private static function icon_box_style( $obj ) { |
| 492 |
$css_selectors = $obj->selectors['counter_icon_style']; |
| 493 |
$title = esc_html__( 'Icon Style', 'shopbuilder' ); |
| 494 |
$selectors = [ |
| 495 |
'icon_size' => [ |
| 496 |
$css_selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}};', |
| 497 |
$css_selectors['icon_size']['svg'] => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};', |
| 498 |
], |
| 499 |
'box_shadow' => $css_selectors['box_shadow'], |
| 500 |
'icon_width' => [ $css_selectors['icon_width'] => 'width: {{SIZE}}{{UNIT}};' ], |
| 501 |
'icon_height' => [ $css_selectors['icon_height'] => 'height: {{SIZE}}{{UNIT}};' ], |
| 502 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 503 |
'gradient_bg' => $css_selectors['gradient_bg'], |
| 504 |
'border' => $css_selectors['border'], |
| 505 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 506 |
'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 507 |
]; |
| 508 |
|
| 509 |
$fields = ControlHelper::general_elementor_style( 'counter_icon_style', $title, $obj, [], $selectors ); |
| 510 |
unset( |
| 511 |
$fields['counter_icon_style_color_tabs'], |
| 512 |
$fields['counter_icon_style_color_tab'], |
| 513 |
$fields['counter_icon_style_typo_note'], |
| 514 |
$fields['rtsb_el_counter_icon_style_typography'], |
| 515 |
$fields['counter_icon_style_bg_color'], |
| 516 |
$fields['counter_icon_style_hover_color'], |
| 517 |
$fields['counter_icon_style_border_hover_color'], |
| 518 |
$fields['counter_icon_style_hover_bg_color'], |
| 519 |
$fields['counter_icon_style_color_tab_end'], |
| 520 |
$fields['counter_icon_style_hover_color_tab'], |
| 521 |
$fields['counter_icon_style_alignment'], |
| 522 |
$fields['counter_icon_style_padding'], |
| 523 |
$fields['counter_icon_style_color_tabs_end'], |
| 524 |
); |
| 525 |
$extra_controls['counter_icon_style_border_radius'] = [ |
| 526 |
'label' => esc_html__( 'Border Radius', 'shopbuilder' ), |
| 527 |
'type' => 'dimensions', |
| 528 |
'mode' => 'responsive', |
| 529 |
'size_units' => [ 'px' ], |
| 530 |
'selectors' => $selectors['border_radius'], |
| 531 |
]; |
| 532 |
$extra_controls['counter_icon_style_box_shadow'] = [ |
| 533 |
'type' => 'box-shadow', |
| 534 |
'mode' => 'group', |
| 535 |
'label' => esc_html__( 'Box Shadow', 'shopbuilder' ), |
| 536 |
'selector' => $selectors['box_shadow'], |
| 537 |
]; |
| 538 |
$fields = Fns::insert_controls( 'counter_icon_style_spacing_note', $fields, $extra_controls ); |
| 539 |
$extra_controls2['counter_icon_style_icon_width'] = [ |
| 540 |
'type' => 'slider', |
| 541 |
'mode' => 'responsive', |
| 542 |
'label' => esc_html__( 'Icon Width', 'shopbuilder' ), |
| 543 |
'size_units' => [ 'px','%' ], |
| 544 |
'range' => [ |
| 545 |
'px' => [ |
| 546 |
'min' => 10, |
| 547 |
'max' => 1000, |
| 548 |
], |
| 549 |
'%' => [ |
| 550 |
'min' => 0, |
| 551 |
'max' => 100, |
| 552 |
], |
| 553 |
], |
| 554 |
'selectors' => $selectors['icon_width'], |
| 555 |
]; |
| 556 |
$extra_controls2['counter_icon_style_icon_height'] = [ |
| 557 |
'type' => 'slider', |
| 558 |
'mode' => 'responsive', |
| 559 |
'label' => esc_html__( 'Icon Height', 'shopbuilder' ), |
| 560 |
'size_units' => [ 'px','%' ], |
| 561 |
'range' => [ |
| 562 |
'px' => [ |
| 563 |
'min' => 10, |
| 564 |
'max' => 1000, |
| 565 |
], |
| 566 |
'%' => [ |
| 567 |
'min' => 0, |
| 568 |
'max' => 100, |
| 569 |
], |
| 570 |
], |
| 571 |
'selectors' => $selectors['icon_height'], |
| 572 |
]; |
| 573 |
|
| 574 |
$extra_controls2['counter_icon_style_icon_size'] = [ |
| 575 |
'type' => 'slider', |
| 576 |
'mode' => 'responsive', |
| 577 |
'label' => esc_html__( 'Icon Size', 'shopbuilder' ), |
| 578 |
'size_units' => [ 'px' ], |
| 579 |
'range' => [ |
| 580 |
'px' => [ |
| 581 |
'min' => 0, |
| 582 |
'max' => 100, |
| 583 |
], |
| 584 |
], |
| 585 |
'selectors' => $selectors['icon_size'], |
| 586 |
]; |
| 587 |
|
| 588 |
$fields = Fns::insert_controls( 'counter_icon_style_spacing_note', $fields, $extra_controls2, true ); |
| 589 |
$extra_controls3['counter_icon_style_gradient_bg'] = [ |
| 590 |
'label' => esc_html__( 'Background', 'shopbuilder' ), |
| 591 |
'type' => 'background', |
| 592 |
'mode' => 'group', |
| 593 |
'selector' => $selectors['gradient_bg'], |
| 594 |
]; |
| 595 |
$fields = Fns::insert_controls( 'counter_icon_style_color', $fields, $extra_controls3, true ); |
| 596 |
|
| 597 |
return $fields; |
| 598 |
} |
| 599 |
|
| 600 |
/** |
| 601 |
* Counter style section |
| 602 |
* |
| 603 |
* @param object $obj Reference object. |
| 604 |
* |
| 605 |
* @return array |
| 606 |
*/ |
| 607 |
public static function counter_count_style( $obj ) { |
| 608 |
$css_selectors = $obj->selectors['counter_count_style']; |
| 609 |
$title = esc_html__( 'Counter Style', 'shopbuilder' ); |
| 610 |
$selectors = [ |
| 611 |
'typography' => $css_selectors['typography'], |
| 612 |
'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], |
| 613 |
'suffix_color' => [ $css_selectors['suffix_color'] => 'color: {{VALUE}};' ], |
| 614 |
'prefix_color' => [ $css_selectors['prefix_color'] => 'color: {{VALUE}};' ], |
| 615 |
'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ], |
| 616 |
]; |
| 617 |
|
| 618 |
$fields = ControlHelper::general_elementor_style( 'counter_count_style', $title, $obj, [], $selectors ); |
| 619 |
|
| 620 |
unset( |
| 621 |
$fields['counter_count_style_alignment'], |
| 622 |
$fields['counter_count_style_border_note'], |
| 623 |
$fields['counter_count_style_padding'], |
| 624 |
$fields['rtsb_el_counter_count_style_border'], |
| 625 |
$fields['counter_count_style_color_tabs'], |
| 626 |
$fields['counter_count_style_color_tab'], |
| 627 |
$fields['counter_count_style_bg_color'], |
| 628 |
$fields['counter_count_style_color_tab_end'], |
| 629 |
$fields['counter_count_style_hover_color_tab'], |
| 630 |
$fields['counter_count_style_hover_color'], |
| 631 |
$fields['counter_count_style_hover_bg_color'], |
| 632 |
$fields['counter_count_style_hover_color_tab_end'], |
| 633 |
$fields['counter_count_style_color_tabs_end'], |
| 634 |
$fields['counter_count_style_border_hover_color'] |
| 635 |
); |
| 636 |
$fields['counter_count_style_color']['label'] = esc_html__( 'Number Color', 'shopbuilder' ); |
| 637 |
$extra_controls['counter_count_style_count_prefix_color'] = [ |
| 638 |
'label' => esc_html__( 'Prefix Color', 'shopbuilder' ), |
| 639 |
'type' => 'color', |
| 640 |
'selectors' => $selectors['prefix_color'], |
| 641 |
]; |
| 642 |
$extra_controls['counter_count_style_count_suffix_color'] = [ |
| 643 |
'label' => esc_html__( 'Suffix Color', 'shopbuilder' ), |
| 644 |
'type' => 'color', |
| 645 |
'selectors' => $selectors['suffix_color'], |
| 646 |
]; |
| 647 |
|
| 648 |
$fields = Fns::insert_controls( 'counter_count_style_color_note', $fields, $extra_controls, true ); |
| 649 |
return $fields; |
| 650 |
} |
| 651 |
} |
| 652 |
|