EAEL_Background.php
2 years ago
EAEL_Choose.php
1 year ago
Select2.php
1 year ago
index.php
3 years ago
EAEL_Background.php
665 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Controls; |
| 4 | |
| 5 | use Elementor\Controls_Manager; |
| 6 | use Elementor\Group_Control_Background; |
| 7 | use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; // Exit if accessed directly. |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * EAEL background control. |
| 15 | * |
| 16 | * A base control for creating background control. Displays input fields to define |
| 17 | * the background color, background image, background gradient or background video. |
| 18 | * |
| 19 | * @since 1.2.2 |
| 20 | */ |
| 21 | class EAEL_Background extends Group_Control_Background { |
| 22 | |
| 23 | /** |
| 24 | * Fields. |
| 25 | * |
| 26 | * Holds all the background control fields. |
| 27 | * |
| 28 | * @since 1.2.2 |
| 29 | * @access protected |
| 30 | * @static |
| 31 | * |
| 32 | * @var array Background control fields. |
| 33 | */ |
| 34 | protected static $fields; |
| 35 | |
| 36 | /** |
| 37 | * Get background control type. |
| 38 | * |
| 39 | * Retrieve the control type, in this case `background`. |
| 40 | * |
| 41 | * @return string Control type. |
| 42 | * @since 1.0.0 |
| 43 | * @access public |
| 44 | * @static |
| 45 | * |
| 46 | */ |
| 47 | public static function get_type() { |
| 48 | return 'eael-background'; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Init fields. |
| 53 | * |
| 54 | * Initialize background control fields. |
| 55 | * |
| 56 | * @return array Control fields. |
| 57 | * @since 1.2.2 |
| 58 | * @access public |
| 59 | * |
| 60 | */ |
| 61 | public function init_fields() { |
| 62 | $fields = []; |
| 63 | |
| 64 | $fields['background'] = [ |
| 65 | 'label' => esc_html_x( 'Background Type', 'Background Control', 'elementor' ), |
| 66 | 'type' => Controls_Manager::CHOOSE, |
| 67 | 'render_type' => 'ui', |
| 68 | ]; |
| 69 | |
| 70 | $fields['color'] = [ |
| 71 | 'label' => esc_html_x( 'Color', 'Background Control', 'elementor' ), |
| 72 | 'type' => Controls_Manager::COLOR, |
| 73 | 'default' => '', |
| 74 | 'title' => esc_html_x( 'Background Color', 'Background Control', 'elementor' ), |
| 75 | 'selectors' => [ |
| 76 | '{{SELECTOR}}' => 'background: {{VALUE}};', |
| 77 | ], |
| 78 | 'condition' => [ |
| 79 | 'background' => [ 'classic', 'gradient', 'video' ], |
| 80 | ], |
| 81 | ]; |
| 82 | |
| 83 | $fields['color_stop'] = [ |
| 84 | 'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ), |
| 85 | 'type' => Controls_Manager::SLIDER, |
| 86 | 'size_units' => [ '%', 'custom' ], |
| 87 | 'default' => [ |
| 88 | 'unit' => '%', |
| 89 | 'size' => 0, |
| 90 | ], |
| 91 | 'render_type' => 'ui', |
| 92 | 'condition' => [ |
| 93 | 'background' => [ 'gradient' ], |
| 94 | ], |
| 95 | 'of_type' => 'gradient', |
| 96 | ]; |
| 97 | |
| 98 | $fields['color_b'] = [ |
| 99 | 'label' => esc_html_x( 'Second Color', 'Background Control', 'elementor' ), |
| 100 | 'type' => Controls_Manager::COLOR, |
| 101 | 'default' => '#f2295b', |
| 102 | 'render_type' => 'ui', |
| 103 | 'condition' => [ |
| 104 | 'background' => [ 'gradient' ], |
| 105 | ], |
| 106 | 'of_type' => 'gradient', |
| 107 | ]; |
| 108 | |
| 109 | $fields['color_b_stop'] = [ |
| 110 | 'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ), |
| 111 | 'type' => Controls_Manager::SLIDER, |
| 112 | 'size_units' => [ '%', 'custom' ], |
| 113 | 'default' => [ |
| 114 | 'unit' => '%', |
| 115 | 'size' => 100, |
| 116 | ], |
| 117 | 'render_type' => 'ui', |
| 118 | 'condition' => [ |
| 119 | 'background' => [ 'gradient' ], |
| 120 | ], |
| 121 | 'of_type' => 'gradient', |
| 122 | ]; |
| 123 | |
| 124 | $fields['gradient_type'] = [ |
| 125 | 'label' => esc_html_x( 'Type', 'Background Control', 'elementor' ), |
| 126 | 'type' => Controls_Manager::SELECT, |
| 127 | 'options' => [ |
| 128 | 'linear' => esc_html_x( 'Linear', 'Background Control', 'elementor' ), |
| 129 | 'radial' => esc_html_x( 'Radial', 'Background Control', 'elementor' ), |
| 130 | ], |
| 131 | 'default' => 'linear', |
| 132 | 'render_type' => 'ui', |
| 133 | 'condition' => [ |
| 134 | 'background' => [ 'gradient' ], |
| 135 | ], |
| 136 | 'of_type' => 'gradient', |
| 137 | ]; |
| 138 | |
| 139 | $fields['gradient_angle'] = [ |
| 140 | 'label' => esc_html_x( 'Angle', 'Background Control', 'elementor' ), |
| 141 | 'type' => Controls_Manager::SLIDER, |
| 142 | 'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ], |
| 143 | 'default' => [ |
| 144 | 'unit' => 'deg', |
| 145 | 'size' => 180, |
| 146 | ], |
| 147 | 'selectors' => [ |
| 148 | '{{SELECTOR}}' => 'background-color: transparent; background-image: linear-gradient({{SIZE}}{{UNIT}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})', |
| 149 | ], |
| 150 | 'condition' => [ |
| 151 | 'background' => [ 'gradient' ], |
| 152 | 'gradient_type' => 'linear', |
| 153 | ], |
| 154 | 'of_type' => 'gradient', |
| 155 | ]; |
| 156 | |
| 157 | $fields['gradient_position'] = [ |
| 158 | 'label' => esc_html_x( 'Position', 'Background Control', 'elementor' ), |
| 159 | 'type' => Controls_Manager::SELECT, |
| 160 | 'options' => [ |
| 161 | 'center center' => esc_html_x( 'Center Center', 'Background Control', 'elementor' ), |
| 162 | 'center left' => esc_html_x( 'Center Left', 'Background Control', 'elementor' ), |
| 163 | 'center right' => esc_html_x( 'Center Right', 'Background Control', 'elementor' ), |
| 164 | 'top center' => esc_html_x( 'Top Center', 'Background Control', 'elementor' ), |
| 165 | 'top left' => esc_html_x( 'Top Left', 'Background Control', 'elementor' ), |
| 166 | 'top right' => esc_html_x( 'Top Right', 'Background Control', 'elementor' ), |
| 167 | 'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'elementor' ), |
| 168 | 'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'elementor' ), |
| 169 | 'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'elementor' ), |
| 170 | ], |
| 171 | 'default' => 'center center', |
| 172 | 'selectors' => [ |
| 173 | '{{SELECTOR}}' => 'background-color: transparent; background-image: radial-gradient(at {{VALUE}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})', |
| 174 | ], |
| 175 | 'condition' => [ |
| 176 | 'background' => [ 'gradient' ], |
| 177 | 'gradient_type' => 'radial', |
| 178 | ], |
| 179 | 'of_type' => 'gradient', |
| 180 | ]; |
| 181 | |
| 182 | $fields['image'] = [ |
| 183 | 'label' => esc_html_x( 'Image', 'Background Control', 'elementor' ), |
| 184 | 'type' => Controls_Manager::MEDIA, |
| 185 | 'ai' => [ |
| 186 | 'category' => 'background', |
| 187 | ], |
| 188 | 'dynamic' => [ |
| 189 | 'active' => true, |
| 190 | ], |
| 191 | 'responsive' => true, |
| 192 | 'title' => esc_html_x( 'Background Image', 'Background Control', 'elementor' ), |
| 193 | 'selectors' => [ |
| 194 | '{{SELECTOR}}' => 'background-image: url("{{URL}}");', |
| 195 | ], |
| 196 | 'has_sizes' => true, |
| 197 | 'render_type' => 'template', |
| 198 | 'condition' => [ |
| 199 | 'background' => [ 'classic' ], |
| 200 | ], |
| 201 | ]; |
| 202 | |
| 203 | $fields['position'] = [ |
| 204 | 'label' => esc_html_x( 'Position', 'Background Control', 'elementor' ), |
| 205 | 'type' => Controls_Manager::SELECT, |
| 206 | 'default' => '', |
| 207 | 'separator' => 'before', |
| 208 | 'responsive' => true, |
| 209 | 'options' => [ |
| 210 | '' => esc_html_x( 'Default', 'Background Control', 'elementor' ), |
| 211 | 'center center' => esc_html_x( 'Center Center', 'Background Control', 'elementor' ), |
| 212 | 'center left' => esc_html_x( 'Center Left', 'Background Control', 'elementor' ), |
| 213 | 'center right' => esc_html_x( 'Center Right', 'Background Control', 'elementor' ), |
| 214 | 'top center' => esc_html_x( 'Top Center', 'Background Control', 'elementor' ), |
| 215 | 'top left' => esc_html_x( 'Top Left', 'Background Control', 'elementor' ), |
| 216 | 'top right' => esc_html_x( 'Top Right', 'Background Control', 'elementor' ), |
| 217 | 'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'elementor' ), |
| 218 | 'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'elementor' ), |
| 219 | 'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'elementor' ), |
| 220 | 'initial' => esc_html_x( 'Custom', 'Background Control', 'elementor' ), |
| 221 | |
| 222 | ], |
| 223 | 'selectors' => [ |
| 224 | '{{SELECTOR}}' => 'background-position: {{VALUE}};', |
| 225 | ], |
| 226 | 'condition' => [ |
| 227 | 'background' => [ 'classic' ], |
| 228 | 'image[url]!' => '', |
| 229 | ], |
| 230 | ]; |
| 231 | |
| 232 | $fields['xpos'] = [ |
| 233 | 'label' => esc_html_x( 'X Position', 'Background Control', 'elementor' ), |
| 234 | 'type' => Controls_Manager::SLIDER, |
| 235 | 'responsive' => true, |
| 236 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 237 | 'default' => [ |
| 238 | 'size' => 0, |
| 239 | ], |
| 240 | 'tablet_default' => [ |
| 241 | 'size' => 0, |
| 242 | ], |
| 243 | 'mobile_default' => [ |
| 244 | 'size' => 0, |
| 245 | ], |
| 246 | 'range' => [ |
| 247 | 'px' => [ |
| 248 | 'min' => - 800, |
| 249 | 'max' => 800, |
| 250 | ], |
| 251 | 'em' => [ |
| 252 | 'min' => - 100, |
| 253 | 'max' => 100, |
| 254 | ], |
| 255 | '%' => [ |
| 256 | 'min' => - 100, |
| 257 | 'max' => 100, |
| 258 | ], |
| 259 | 'vw' => [ |
| 260 | 'min' => - 100, |
| 261 | 'max' => 100, |
| 262 | ], |
| 263 | ], |
| 264 | 'selectors' => [ |
| 265 | '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}', |
| 266 | ], |
| 267 | 'condition' => [ |
| 268 | 'background' => [ 'classic' ], |
| 269 | 'position' => [ 'initial' ], |
| 270 | 'image[url]!' => '', |
| 271 | ], |
| 272 | 'required' => true, |
| 273 | ]; |
| 274 | |
| 275 | $fields['ypos'] = [ |
| 276 | 'label' => esc_html_x( 'Y Position', 'Background Control', 'elementor' ), |
| 277 | 'type' => Controls_Manager::SLIDER, |
| 278 | 'responsive' => true, |
| 279 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ], |
| 280 | 'default' => [ |
| 281 | 'size' => 0, |
| 282 | ], |
| 283 | 'tablet_default' => [ |
| 284 | 'size' => 0, |
| 285 | ], |
| 286 | 'mobile_default' => [ |
| 287 | 'size' => 0, |
| 288 | ], |
| 289 | 'range' => [ |
| 290 | 'px' => [ |
| 291 | 'min' => - 800, |
| 292 | 'max' => 800, |
| 293 | ], |
| 294 | 'em' => [ |
| 295 | 'min' => - 100, |
| 296 | 'max' => 100, |
| 297 | ], |
| 298 | '%' => [ |
| 299 | 'min' => - 100, |
| 300 | 'max' => 100, |
| 301 | ], |
| 302 | 'vh' => [ |
| 303 | 'min' => - 100, |
| 304 | 'max' => 100, |
| 305 | ], |
| 306 | ], |
| 307 | 'selectors' => [ |
| 308 | '{{SELECTOR}}' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}', |
| 309 | ], |
| 310 | 'condition' => [ |
| 311 | 'background' => [ 'classic' ], |
| 312 | 'position' => [ 'initial' ], |
| 313 | 'image[url]!' => '', |
| 314 | ], |
| 315 | 'required' => true, |
| 316 | ]; |
| 317 | |
| 318 | $fields['attachment'] = [ |
| 319 | 'label' => esc_html_x( 'Attachment', 'Background Control', 'elementor' ), |
| 320 | 'type' => Controls_Manager::SELECT, |
| 321 | 'default' => '', |
| 322 | 'options' => [ |
| 323 | '' => esc_html_x( 'Default', 'Background Control', 'elementor' ), |
| 324 | 'scroll' => esc_html_x( 'Scroll', 'Background Control', 'elementor' ), |
| 325 | 'fixed' => esc_html_x( 'Fixed', 'Background Control', 'elementor' ), |
| 326 | ], |
| 327 | 'selectors' => [ |
| 328 | '(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};', |
| 329 | ], |
| 330 | 'condition' => [ |
| 331 | 'background' => [ 'classic' ], |
| 332 | 'image[url]!' => '', |
| 333 | ], |
| 334 | ]; |
| 335 | |
| 336 | $fields['attachment_alert'] = [ |
| 337 | 'type' => Controls_Manager::RAW_HTML, |
| 338 | 'content_classes' => 'elementor-control-field-description', |
| 339 | 'raw' => esc_html__( 'Note: Attachment Fixed works only on desktop.', 'elementor' ), |
| 340 | 'separator' => 'none', |
| 341 | 'condition' => [ |
| 342 | 'background' => [ 'classic' ], |
| 343 | 'image[url]!' => '', |
| 344 | 'attachment' => 'fixed', |
| 345 | ], |
| 346 | ]; |
| 347 | |
| 348 | $fields['repeat'] = [ |
| 349 | 'label' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ), |
| 350 | 'type' => Controls_Manager::SELECT, |
| 351 | 'default' => '', |
| 352 | 'responsive' => true, |
| 353 | 'options' => [ |
| 354 | '' => esc_html_x( 'Default', 'Background Control', 'elementor' ), |
| 355 | 'no-repeat' => esc_html_x( 'No-repeat', 'Background Control', 'elementor' ), |
| 356 | 'repeat' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ), |
| 357 | 'repeat-x' => esc_html_x( 'Repeat-x', 'Background Control', 'elementor' ), |
| 358 | 'repeat-y' => esc_html_x( 'Repeat-y', 'Background Control', 'elementor' ), |
| 359 | ], |
| 360 | 'selectors' => [ |
| 361 | '{{SELECTOR}}' => 'background-repeat: {{VALUE}};', |
| 362 | ], |
| 363 | 'condition' => [ |
| 364 | 'background' => [ 'classic' ], |
| 365 | 'image[url]!' => '', |
| 366 | ], |
| 367 | ]; |
| 368 | |
| 369 | $fields['size'] = [ |
| 370 | 'label' => esc_html_x( 'Display Size', 'Background Control', 'elementor' ), |
| 371 | 'type' => Controls_Manager::SELECT, |
| 372 | 'responsive' => true, |
| 373 | 'default' => '', |
| 374 | 'options' => [ |
| 375 | '' => esc_html_x( 'Default', 'Background Control', 'elementor' ), |
| 376 | 'auto' => esc_html_x( 'Auto', 'Background Control', 'elementor' ), |
| 377 | 'cover' => esc_html_x( 'Cover', 'Background Control', 'elementor' ), |
| 378 | 'contain' => esc_html_x( 'Contain', 'Background Control', 'elementor' ), |
| 379 | 'initial' => esc_html_x( 'Custom', 'Background Control', 'elementor' ), |
| 380 | ], |
| 381 | 'selectors' => [ |
| 382 | '{{SELECTOR}}' => 'background-size: {{VALUE}};', |
| 383 | ], |
| 384 | 'condition' => [ |
| 385 | 'background' => [ 'classic' ], |
| 386 | 'image[url]!' => '', |
| 387 | ], |
| 388 | ]; |
| 389 | |
| 390 | $fields['bg_width'] = [ |
| 391 | 'label' => esc_html_x( 'Width', 'Background Control', 'elementor' ), |
| 392 | 'type' => Controls_Manager::SLIDER, |
| 393 | 'responsive' => true, |
| 394 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 395 | 'range' => [ |
| 396 | 'px' => [ |
| 397 | 'min' => 0, |
| 398 | 'max' => 1000, |
| 399 | ], |
| 400 | '%' => [ |
| 401 | 'min' => 0, |
| 402 | 'max' => 100, |
| 403 | ], |
| 404 | 'vw' => [ |
| 405 | 'min' => 0, |
| 406 | 'max' => 100, |
| 407 | ], |
| 408 | ], |
| 409 | 'default' => [ |
| 410 | 'size' => 100, |
| 411 | 'unit' => '%', |
| 412 | ], |
| 413 | 'required' => true, |
| 414 | 'selectors' => [ |
| 415 | '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto', |
| 416 | |
| 417 | ], |
| 418 | 'condition' => [ |
| 419 | 'background' => [ 'classic' ], |
| 420 | 'size' => [ 'initial' ], |
| 421 | 'image[url]!' => '', |
| 422 | ], |
| 423 | ]; |
| 424 | |
| 425 | $fields['video_link'] = [ |
| 426 | 'label' => esc_html_x( 'Video Link', 'Background Control', 'elementor' ), |
| 427 | 'type' => Controls_Manager::TEXT, |
| 428 | 'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E', |
| 429 | 'description' => esc_html__( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ), |
| 430 | 'label_block' => true, |
| 431 | 'default' => '', |
| 432 | 'dynamic' => [ |
| 433 | 'active' => true, |
| 434 | 'categories' => [ |
| 435 | TagsModule::POST_META_CATEGORY, |
| 436 | TagsModule::URL_CATEGORY, |
| 437 | ], |
| 438 | ], |
| 439 | 'condition' => [ |
| 440 | 'background' => [ 'video' ], |
| 441 | ], |
| 442 | 'of_type' => 'video', |
| 443 | 'frontend_available' => true, |
| 444 | ]; |
| 445 | |
| 446 | $fields['video_start'] = [ |
| 447 | 'label' => esc_html__( 'Start Time', 'elementor' ), |
| 448 | 'type' => Controls_Manager::NUMBER, |
| 449 | 'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ), |
| 450 | 'placeholder' => 10, |
| 451 | 'condition' => [ |
| 452 | 'background' => [ 'video' ], |
| 453 | ], |
| 454 | 'of_type' => 'video', |
| 455 | 'frontend_available' => true, |
| 456 | ]; |
| 457 | |
| 458 | $fields['video_end'] = [ |
| 459 | 'label' => esc_html__( 'End Time', 'elementor' ), |
| 460 | 'type' => Controls_Manager::NUMBER, |
| 461 | 'description' => esc_html__( 'Specify an end time (in seconds)', 'elementor' ), |
| 462 | 'placeholder' => 70, |
| 463 | 'condition' => [ |
| 464 | 'background' => [ 'video' ], |
| 465 | ], |
| 466 | 'of_type' => 'video', |
| 467 | 'frontend_available' => true, |
| 468 | ]; |
| 469 | |
| 470 | $fields['play_once'] = [ |
| 471 | 'label' => esc_html__( 'Play Once', 'elementor' ), |
| 472 | 'type' => Controls_Manager::SWITCHER, |
| 473 | 'condition' => [ |
| 474 | 'background' => [ 'video' ], |
| 475 | ], |
| 476 | 'of_type' => 'video', |
| 477 | 'frontend_available' => true, |
| 478 | ]; |
| 479 | |
| 480 | $fields['play_on_mobile'] = [ |
| 481 | 'label' => esc_html__( 'Play On Mobile', 'elementor' ), |
| 482 | 'type' => Controls_Manager::SWITCHER, |
| 483 | 'condition' => [ |
| 484 | 'background' => [ 'video' ], |
| 485 | ], |
| 486 | 'of_type' => 'video', |
| 487 | 'frontend_available' => true, |
| 488 | ]; |
| 489 | |
| 490 | // This control was added to handle a bug with the Youtube Embed API. The bug: If there is a video with Privacy |
| 491 | // Mode on, and at the same time the page contains another video WITHOUT privacy mode on, one of the videos |
| 492 | // will not run properly. This added control allows users to align all their videos to one host (either |
| 493 | // youtube.com or youtube-nocookie.com, depending on whether the user wants privacy mode on or not). |
| 494 | $fields['privacy_mode'] = [ |
| 495 | 'label' => esc_html__( 'Privacy Mode', 'elementor' ), |
| 496 | 'type' => Controls_Manager::SWITCHER, |
| 497 | 'condition' => [ |
| 498 | 'background' => [ 'video' ], |
| 499 | ], |
| 500 | 'of_type' => 'video', |
| 501 | 'frontend_available' => true, |
| 502 | ]; |
| 503 | |
| 504 | $fields['video_fallback'] = [ |
| 505 | 'label' => esc_html_x( 'Background Fallback', 'Background Control', 'elementor' ), |
| 506 | 'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ), |
| 507 | 'type' => Controls_Manager::MEDIA, |
| 508 | 'dynamic' => [ |
| 509 | 'active' => true, |
| 510 | ], |
| 511 | 'condition' => [ |
| 512 | 'background' => [ 'video' ], |
| 513 | ], |
| 514 | 'selectors' => [ |
| 515 | '{{SELECTOR}}' => 'background: url("{{URL}}") 50% 50%; background-size: cover;', |
| 516 | ], |
| 517 | 'of_type' => 'video', |
| 518 | ]; |
| 519 | |
| 520 | $fields['slideshow_gallery'] = [ |
| 521 | 'label' => esc_html_x( 'Images', 'Background Control', 'elementor' ), |
| 522 | 'type' => Controls_Manager::GALLERY, |
| 523 | 'condition' => [ |
| 524 | 'background' => [ 'slideshow' ], |
| 525 | ], |
| 526 | 'show_label' => false, |
| 527 | 'of_type' => 'slideshow', |
| 528 | 'frontend_available' => true, |
| 529 | ]; |
| 530 | |
| 531 | $fields['slideshow_loop'] = [ |
| 532 | 'label' => esc_html__( 'Infinite Loop', 'elementor' ), |
| 533 | 'type' => Controls_Manager::SWITCHER, |
| 534 | 'default' => 'yes', |
| 535 | 'condition' => [ |
| 536 | 'background' => [ 'slideshow' ], |
| 537 | ], |
| 538 | 'of_type' => 'slideshow', |
| 539 | 'frontend_available' => true, |
| 540 | ]; |
| 541 | |
| 542 | $fields['slideshow_slide_duration'] = [ |
| 543 | 'label' => esc_html__( 'Duration', 'elementor' ) . ' (ms)', |
| 544 | 'type' => Controls_Manager::NUMBER, |
| 545 | 'default' => 5000, |
| 546 | 'condition' => [ |
| 547 | 'background' => [ 'slideshow' ], |
| 548 | ], |
| 549 | 'frontend_available' => true, |
| 550 | ]; |
| 551 | |
| 552 | $fields['slideshow_slide_transition'] = [ |
| 553 | 'label' => esc_html__( 'Transition', 'elementor' ), |
| 554 | 'type' => Controls_Manager::SELECT, |
| 555 | 'default' => 'fade', |
| 556 | 'options' => [ |
| 557 | 'fade' => 'Fade', |
| 558 | 'slide_right' => 'Slide Right', |
| 559 | 'slide_left' => 'Slide Left', |
| 560 | 'slide_up' => 'Slide Up', |
| 561 | 'slide_down' => 'Slide Down', |
| 562 | ], |
| 563 | 'condition' => [ |
| 564 | 'background' => [ 'slideshow' ], |
| 565 | ], |
| 566 | 'of_type' => 'slideshow', |
| 567 | 'frontend_available' => true, |
| 568 | ]; |
| 569 | |
| 570 | $fields['slideshow_transition_duration'] = [ |
| 571 | 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)', |
| 572 | 'type' => Controls_Manager::NUMBER, |
| 573 | 'default' => 500, |
| 574 | 'condition' => [ |
| 575 | 'background' => [ 'slideshow' ], |
| 576 | ], |
| 577 | 'frontend_available' => true, |
| 578 | ]; |
| 579 | |
| 580 | $fields['slideshow_background_size'] = [ |
| 581 | 'label' => esc_html__( 'Background Size', 'elementor' ), |
| 582 | 'type' => Controls_Manager::SELECT, |
| 583 | 'responsive' => true, |
| 584 | 'default' => '', |
| 585 | 'options' => [ |
| 586 | '' => esc_html__( 'Default', 'elementor' ), |
| 587 | 'auto' => esc_html__( 'Auto', 'elementor' ), |
| 588 | 'cover' => esc_html__( 'Cover', 'elementor' ), |
| 589 | 'contain' => esc_html__( 'Contain', 'elementor' ), |
| 590 | ], |
| 591 | 'selectors' => [ |
| 592 | '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};', |
| 593 | ], |
| 594 | 'condition' => [ |
| 595 | 'background' => [ 'slideshow' ], |
| 596 | ], |
| 597 | ]; |
| 598 | |
| 599 | $fields['slideshow_background_position'] = [ |
| 600 | 'label' => esc_html__( 'Background Position', 'elementor' ), |
| 601 | 'type' => Controls_Manager::SELECT, |
| 602 | 'default' => '', |
| 603 | 'responsive' => true, |
| 604 | 'options' => [ |
| 605 | '' => esc_html__( 'Default', 'elementor' ), |
| 606 | 'center center' => esc_html_x( 'Center Center', 'Background Control', 'elementor' ), |
| 607 | 'center left' => esc_html_x( 'Center Left', 'Background Control', 'elementor' ), |
| 608 | 'center right' => esc_html_x( 'Center Right', 'Background Control', 'elementor' ), |
| 609 | 'top center' => esc_html_x( 'Top Center', 'Background Control', 'elementor' ), |
| 610 | 'top left' => esc_html_x( 'Top Left', 'Background Control', 'elementor' ), |
| 611 | 'top right' => esc_html_x( 'Top Right', 'Background Control', 'elementor' ), |
| 612 | 'bottom center' => esc_html_x( 'Bottom Center', 'Background Control', 'elementor' ), |
| 613 | 'bottom left' => esc_html_x( 'Bottom Left', 'Background Control', 'elementor' ), |
| 614 | 'bottom right' => esc_html_x( 'Bottom Right', 'Background Control', 'elementor' ), |
| 615 | ], |
| 616 | 'selectors' => [ |
| 617 | '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};', |
| 618 | ], |
| 619 | 'condition' => [ |
| 620 | 'background' => [ 'slideshow' ], |
| 621 | ], |
| 622 | ]; |
| 623 | |
| 624 | $fields['slideshow_lazyload'] = [ |
| 625 | 'label' => esc_html__( 'Lazyload', 'elementor' ), |
| 626 | 'type' => Controls_Manager::SWITCHER, |
| 627 | 'separator' => 'before', |
| 628 | 'condition' => [ |
| 629 | 'background' => [ 'slideshow' ], |
| 630 | ], |
| 631 | 'of_type' => 'slideshow', |
| 632 | 'frontend_available' => true, |
| 633 | ]; |
| 634 | |
| 635 | $fields['slideshow_ken_burns'] = [ |
| 636 | 'label' => esc_html__( 'Ken Burns Effect', 'elementor' ), |
| 637 | 'type' => Controls_Manager::SWITCHER, |
| 638 | 'separator' => 'before', |
| 639 | 'condition' => [ |
| 640 | 'background' => [ 'slideshow' ], |
| 641 | ], |
| 642 | 'of_type' => 'slideshow', |
| 643 | 'frontend_available' => true, |
| 644 | ]; |
| 645 | |
| 646 | $fields['slideshow_ken_burns_zoom_direction'] = [ |
| 647 | 'label' => esc_html__( 'Direction', 'elementor' ), |
| 648 | 'type' => Controls_Manager::SELECT, |
| 649 | 'default' => 'in', |
| 650 | 'options' => [ |
| 651 | 'in' => esc_html__( 'In', 'elementor' ), |
| 652 | 'out' => esc_html__( 'Out', 'elementor' ), |
| 653 | ], |
| 654 | 'condition' => [ |
| 655 | 'background' => [ 'slideshow' ], |
| 656 | 'slideshow_ken_burns!' => '', |
| 657 | ], |
| 658 | 'of_type' => 'slideshow', |
| 659 | 'frontend_available' => true, |
| 660 | ]; |
| 661 | |
| 662 | return $fields; |
| 663 | } |
| 664 | |
| 665 | } |