| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main ProductDescription class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\Controls; |
| 9 |
|
| 10 |
use Elementor\Controls_Manager; |
| 11 |
use RadiusTheme\SB\Elementor\Helper\ControlSelectors; |
| 12 |
use RadiusTheme\SB\Helpers\Fns; |
| 13 |
|
| 14 |
// Do not allow directly accessing this file. |
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit( 'This script cannot be accessed directly.' ); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Product Description class |
| 21 |
*/ |
| 22 |
class SliderSettings { |
| 23 |
/** |
| 24 |
* Widget Field |
| 25 |
* |
| 26 |
* @return array |
| 27 |
*/ |
| 28 |
public static function slider_style( $widget ) { |
| 29 |
$selector = $widget->selectors; |
| 30 |
$fields = [ |
| 31 |
'slider_style_start' => [ |
| 32 |
'mode' => 'section_start', |
| 33 |
'tab' => 'style', |
| 34 |
'label' => esc_html__( 'Slider Style', 'shopbuilder' ), |
| 35 |
'condition' => [ |
| 36 |
'slider_activate!' => '', |
| 37 |
], |
| 38 |
], |
| 39 |
'slider_arrows_style' => [ |
| 40 |
'type' => 'html', |
| 41 |
'raw' => sprintf( |
| 42 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 43 |
esc_html__( 'Arrows', 'shopbuilder' ) |
| 44 |
), |
| 45 |
'content_classes' => 'elementor-panel-heading-title', |
| 46 |
'separator' => 'default', |
| 47 |
'condition' => [ |
| 48 |
'show_arrows!' => '', |
| 49 |
], |
| 50 |
], |
| 51 |
|
| 52 |
'slider_arrow_icon_size' => [ |
| 53 |
'label' => esc_html__( 'Icon Size (px)', 'shopbuilder' ), |
| 54 |
'type' => 'slider', |
| 55 |
'size_units' => [ 'px' ], |
| 56 |
'range' => [ |
| 57 |
'px' => [ |
| 58 |
'min' => 0, |
| 59 |
'max' => 100, |
| 60 |
'step' => 5, |
| 61 |
], |
| 62 |
], |
| 63 |
'default' => [ |
| 64 |
'unit' => 'px', |
| 65 |
'size' => 25, |
| 66 |
], |
| 67 |
'selectors' => [ |
| 68 |
$selector['slider_arrow_icon_size'] => 'font-size: {{SIZE}}{{UNIT}};', |
| 69 |
], |
| 70 |
'condition' => [ |
| 71 |
'show_arrows!' => '', |
| 72 |
], |
| 73 |
], |
| 74 |
'slider_arrow_size' => [ |
| 75 |
'label' => esc_html__( 'Arrow Size (px)', 'shopbuilder' ), |
| 76 |
'type' => 'slider', |
| 77 |
'size_units' => [ 'px' ], |
| 78 |
'range' => [ |
| 79 |
'px' => [ |
| 80 |
'min' => 0, |
| 81 |
'max' => 100, |
| 82 |
'step' => 5, |
| 83 |
], |
| 84 |
], |
| 85 |
'default' => [ |
| 86 |
'unit' => 'px', |
| 87 |
'size' => 40, |
| 88 |
], |
| 89 |
'selectors' => [ |
| 90 |
$selector['slider_arrow_size'] => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};', |
| 91 |
], |
| 92 |
'condition' => [ |
| 93 |
'show_arrows!' => '', |
| 94 |
], |
| 95 |
], |
| 96 |
|
| 97 |
'arrows_tabs_start' => [ |
| 98 |
'mode' => 'tabs_start', |
| 99 |
], |
| 100 |
// Tab For normal view. |
| 101 |
'arrows_normal' => [ |
| 102 |
'mode' => 'tab_start', |
| 103 |
'label' => esc_html__( 'Normal', 'shopbuilder' ), |
| 104 |
'condition' => [ |
| 105 |
'show_arrows!' => '', |
| 106 |
], |
| 107 |
], |
| 108 |
'arrows_color' => [ |
| 109 |
'label' => esc_html__( 'Color', 'shopbuilder' ), |
| 110 |
'type' => 'color', |
| 111 |
|
| 112 |
'selectors' => [ |
| 113 |
$selector['arrows_color'] => 'color: {{VALUE}};', |
| 114 |
], |
| 115 |
], |
| 116 |
'arrows_bg_color' => [ |
| 117 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 118 |
'type' => 'color', |
| 119 |
'selectors' => [ |
| 120 |
$selector['arrows_bg_color'] => 'background-color: {{VALUE}};', |
| 121 |
], |
| 122 |
], |
| 123 |
'arrows_border_color' => [ |
| 124 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 125 |
'type' => 'color', |
| 126 |
|
| 127 |
'selectors' => [ |
| 128 |
$selector['arrows_border_color'] => 'border-color: {{VALUE}};', |
| 129 |
], |
| 130 |
], |
| 131 |
'arrows_normal_end' => [ |
| 132 |
'mode' => 'tab_end', |
| 133 |
], |
| 134 |
'arrows_hover' => [ |
| 135 |
'mode' => 'tab_start', |
| 136 |
'label' => esc_html__( 'Hover', 'shopbuilder' ), |
| 137 |
'condition' => [ |
| 138 |
'show_arrows!' => '', |
| 139 |
], |
| 140 |
], |
| 141 |
'arrows_hover_color' => [ |
| 142 |
'label' => esc_html__( 'Color', 'shopbuilder' ), |
| 143 |
'type' => 'color', |
| 144 |
'selectors' => [ |
| 145 |
$selector['arrows_hover_color'] => 'color: {{VALUE}};', |
| 146 |
], |
| 147 |
], |
| 148 |
'arrows_hover_bg_color' => [ |
| 149 |
'label' => esc_html__( 'Background Color', 'shopbuilder' ), |
| 150 |
'type' => 'color', |
| 151 |
'selectors' => [ |
| 152 |
$selector['arrows_hover_color'] => 'background-color: {{VALUE}};', |
| 153 |
], |
| 154 |
], |
| 155 |
'arrows_hover_border_color' => [ |
| 156 |
'label' => esc_html__( 'Border Color', 'shopbuilder' ), |
| 157 |
'type' => 'color', |
| 158 |
|
| 159 |
'selectors' => [ |
| 160 |
$selector['arrows_hover_border_color'] => 'border-color: {{VALUE}};', |
| 161 |
], |
| 162 |
], |
| 163 |
'arrows_hover_end' => [ |
| 164 |
'mode' => 'tab_end', |
| 165 |
], |
| 166 |
'arrows_tabs_end' => [ |
| 167 |
'mode' => 'tabs_end', |
| 168 |
], |
| 169 |
//'style_section_end' => [ |
| 170 |
// 'mode' => 'section_end', |
| 171 |
//], |
| 172 |
'slider_dots_style' => [ |
| 173 |
'type' => 'html', |
| 174 |
'raw' => sprintf( |
| 175 |
'<h3 class="rtsb-elementor-group-heading">%s</h3>', |
| 176 |
esc_html__( 'Dot\'s', 'shopbuilder' ) |
| 177 |
), |
| 178 |
'content_classes' => 'elementor-panel-heading-title', |
| 179 |
'separator' => 'default', |
| 180 |
'condition' => [ |
| 181 |
'show_arrows!' => '', |
| 182 |
], |
| 183 |
], |
| 184 |
'dots_gap' => [ |
| 185 |
'label' => esc_html__( 'Dot\'s Spacing (px)', 'shopbuilder' ), |
| 186 |
'type' => 'slider', |
| 187 |
'size_units' => [ 'px' ], |
| 188 |
'range' => [ |
| 189 |
'px' => [ |
| 190 |
'min' => 0, |
| 191 |
'max' => 100, |
| 192 |
'step' => 1, |
| 193 |
], |
| 194 |
], |
| 195 |
'default' => [ |
| 196 |
'unit' => 'px', |
| 197 |
'size' => 30, |
| 198 |
], |
| 199 |
'selectors' => [ |
| 200 |
$selector['dots_gap'] => 'padding-bottom: {{SIZE}}{{UNIT}};', |
| 201 |
], |
| 202 |
'condition' => [ |
| 203 |
'show_dots!' => '', |
| 204 |
], |
| 205 |
], |
| 206 |
'dots_size' => [ |
| 207 |
'label' => esc_html__( 'Dot\'s Size (px)', 'shopbuilder' ), |
| 208 |
'type' => 'slider', |
| 209 |
'size_units' => [ 'px' ], |
| 210 |
'range' => [ |
| 211 |
'px' => [ |
| 212 |
'min' => 0, |
| 213 |
'max' => 50, |
| 214 |
'step' => 1, |
| 215 |
], |
| 216 |
], |
| 217 |
'default' => [ |
| 218 |
'unit' => 'px', |
| 219 |
'size' => 6, |
| 220 |
], |
| 221 |
'selectors' => [ |
| 222 |
$selector['dots_size'] => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', |
| 223 |
], |
| 224 |
'condition' => [ |
| 225 |
'show_dots!' => '', |
| 226 |
], |
| 227 |
], |
| 228 |
'dot_color' => [ |
| 229 |
'label' => esc_html__( 'Dot\'s Color', 'shopbuilder' ), |
| 230 |
'type' => 'color', |
| 231 |
|
| 232 |
'selectors' => [ |
| 233 |
$selector['dot_color'] => 'background: {{VALUE}};', |
| 234 |
], |
| 235 |
], |
| 236 |
'dot_active_color' => [ |
| 237 |
'label' => esc_html__( 'Dot\'s Active Color', 'shopbuilder' ), |
| 238 |
'type' => 'color', |
| 239 |
|
| 240 |
'selectors' => [ |
| 241 |
$selector['dot_active_color'] => 'background: {{VALUE}};', |
| 242 |
], |
| 243 |
], |
| 244 |
'slider_style_end' => [ |
| 245 |
'mode' => 'section_end', |
| 246 |
], |
| 247 |
]; |
| 248 |
return $fields; |
| 249 |
} |
| 250 |
/** |
| 251 |
* Widget Field |
| 252 |
* |
| 253 |
* @return array |
| 254 |
*/ |
| 255 |
public static function slider_controls() { |
| 256 |
$fields = [ |
| 257 |
'slider_section_start' => [ |
| 258 |
'mode' => 'section_start', |
| 259 |
'label' => esc_html__( 'Slider', 'shopbuilder' ), |
| 260 |
'condition' => [ |
| 261 |
'slider_activate!' => '', |
| 262 |
], |
| 263 |
], |
| 264 |
'space_between' => [ |
| 265 |
'label' => esc_html__( 'Space between', 'shopbuilder' ), |
| 266 |
'type' => 'number', |
| 267 |
'separator' => 'default', |
| 268 |
'default' => 10, |
| 269 |
'min' => 1, |
| 270 |
'max' => 100, |
| 271 |
], |
| 272 |
'loop' => [ |
| 273 |
'label' => esc_html__( 'Loop', 'shopbuilder' ), |
| 274 |
'type' => 'switch', |
| 275 |
'label_on' => esc_html__( 'Yes', 'shopbuilder' ), |
| 276 |
'label_off' => esc_html__( 'No', 'shopbuilder' ), |
| 277 |
'default' => '', |
| 278 |
'return_value' => 'yes', |
| 279 |
], |
| 280 |
'speed' => [ |
| 281 |
'label' => esc_html__( 'Slide Speed', 'shopbuilder' ), |
| 282 |
'type' => 'number', |
| 283 |
'default' => 2000, |
| 284 |
'min' => 0, |
| 285 |
'max' => 10000, |
| 286 |
], |
| 287 |
'autoplay' => [ |
| 288 |
'label' => esc_html__( 'Autoplay', 'shopbuilder' ), |
| 289 |
'type' => 'switch', |
| 290 |
'label_on' => esc_html__( 'Yes', 'shopbuilder' ), |
| 291 |
'label_off' => esc_html__( 'No', 'shopbuilder' ), |
| 292 |
'default' => 'yes', |
| 293 |
'return_value' => 'yes', |
| 294 |
], |
| 295 |
'autoplay_delay' => [ |
| 296 |
'label' => esc_html__( 'Slide Delay', 'shopbuilder' ), |
| 297 |
'type' => 'number', |
| 298 |
'default' => 3000, |
| 299 |
'min' => 0, |
| 300 |
'max' => 10000, |
| 301 |
'condition' => [ |
| 302 |
'autoplay' => 'yes', |
| 303 |
], |
| 304 |
], |
| 305 |
|
| 306 |
'pauseon_mouseenter' => [ |
| 307 |
'label' => esc_html__( 'Pause On Mouse Enter', 'shopbuilder' ), |
| 308 |
'type' => 'switch', |
| 309 |
'label_on' => esc_html__( 'Yes', 'shopbuilder' ), |
| 310 |
'label_off' => esc_html__( 'No', 'shopbuilder' ), |
| 311 |
'default' => 'yes', |
| 312 |
'return_value' => 'yes', |
| 313 |
'condition' => [ |
| 314 |
'autoplay' => 'yes', |
| 315 |
], |
| 316 |
], |
| 317 |
'show_arrows' => [ |
| 318 |
'label' => esc_html__( 'Show Arrows', 'shopbuilder' ), |
| 319 |
'type' => 'switch', |
| 320 |
'label_off' => esc_html__( 'Show', 'shopbuilder' ), |
| 321 |
'label_on' => esc_html__( 'Hide', 'shopbuilder' ), |
| 322 |
'default' => 'yes', |
| 323 |
'return_value' => 'yes', |
| 324 |
], |
| 325 |
'show_dots' => [ |
| 326 |
'label' => esc_html__( 'Show Dots', 'shopbuilder' ), |
| 327 |
'type' => 'switch', |
| 328 |
'label_off' => esc_html__( 'Show', 'shopbuilder' ), |
| 329 |
'label_on' => esc_html__( 'Hide', 'shopbuilder' ), |
| 330 |
'default' => 'yes', |
| 331 |
'return_value' => 'yes', |
| 332 |
], |
| 333 |
'left_arrow_icon' => [ |
| 334 |
'label' => esc_html__( 'Left Arrow', 'shopbuilder' ), |
| 335 |
'type' => 'icons', |
| 336 |
'fa4compatibility' => 'icon', |
| 337 |
'default' => [ |
| 338 |
'value' => 'fas fa-chevron-left', |
| 339 |
'library' => 'fa-solid', |
| 340 |
], |
| 341 |
'condition' => [ |
| 342 |
'show_arrows' => 'yes', |
| 343 |
], |
| 344 |
], |
| 345 |
'right_arrow_icon' => [ |
| 346 |
'label' => esc_html__( 'Right Arrow', 'shopbuilder' ), |
| 347 |
'type' => 'icons', |
| 348 |
'fa4compatibility' => 'icon', |
| 349 |
'default' => [ |
| 350 |
'value' => 'fas fa-chevron-right', |
| 351 |
'library' => 'fa-solid', |
| 352 |
], |
| 353 |
'condition' => [ |
| 354 |
'show_arrows' => 'yes', |
| 355 |
], |
| 356 |
], |
| 357 |
|
| 358 |
'slider_section_end' => [ |
| 359 |
'mode' => 'section_end', |
| 360 |
], |
| 361 |
]; |
| 362 |
|
| 363 |
return $fields; |
| 364 |
} |
| 365 |
|
| 366 |
} |
| 367 |
|