← All changes
|
includes/widgets/Auto_Scrolling_Text/Auto_Scrolling_Text.php
+1145
-0
51.1.2
→
51.1.87
View file →
| @@ -1,0 +1,1145 @@ | ||
| 1 | +<?php /** @noinspection SpellCheckingInspection, DuplicatedCode, PhpUnused */ | |
| 2 | + | |
| 3 | +namespace King_Addons; | |
| 4 | + | |
| 5 | +use Elementor\Controls_Manager; | |
| 6 | +use Elementor\Group_Control_Background; | |
| 7 | +use Elementor\Group_Control_Border; | |
| 8 | +use Elementor\Group_Control_Box_Shadow; | |
| 9 | +use Elementor\Group_Control_Image_Size; | |
| 10 | +use Elementor\Group_Control_Typography; | |
| 11 | +use Elementor\Repeater; | |
| 12 | +use Elementor\Utils; | |
| 13 | +use Elementor\Widget_Base; | |
| 14 | + | |
| 15 | +if (!defined('ABSPATH')) { | |
| 16 | + exit; // Exit if accessed directly. | |
| 17 | +} | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | +class Auto_Scrolling_Text extends Widget_Base | |
| 22 | +{ | |
| 23 | + | |
| 24 | + | |
| 25 | + public function get_name(): string | |
| 26 | + { | |
| 27 | + return 'king-addons-auto-scrolling-text'; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public function get_title(): string | |
| 31 | + { | |
| 32 | + return esc_html__('Auto-Scrolling Text', 'king-addons'); | |
| 33 | + } | |
| 34 | + | |
| 35 | + public function get_icon(): string | |
| 36 | + { | |
| 37 | + /** @noinspection SpellCheckingInspection */ | |
| 38 | + return 'king-addons-icon king-addons-auto-scrolling-text'; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public function get_style_depends(): array | |
| 42 | + { | |
| 43 | + return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-auto-scrolling-text-style']; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public function get_script_depends(): array | |
| 47 | + { | |
| 48 | + return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-auto-scrolling-text-script']; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public function get_categories(): array | |
| 52 | + { | |
| 53 | + return ['king-addons']; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function get_keywords(): array | |
| 57 | + { | |
| 58 | + return ['card', 'carousel', 'slider', 'scroller', 'swiper', 'content', 'button', 'dot', 'dots', 'navigation', | |
| 59 | + 'cards', 'wheel', 'touch', 'nav', 'navigation', 'animation', 'effect', 'animated', 'template', 'link', | |
| 60 | + 'left', 'right', 'top', 'bottom', 'vertical', 'horizontal', 'mouse', 'dragging', 'hover', 'over', | |
| 61 | + 'hover over', 'picture', 'float', 'floating', 'sticky', 'click', 'target', 'point', 'king', 'addons', | |
| 62 | + 'mouseover', 'page', 'card carousel', 'kingaddons', 'king-addons', 'team', 'members', 'testimonial', | |
| 63 | + 'testimonials', 'reviews', ' team memebers', 'drag', 'tabs', 'tab', | |
| 64 | + 'image', 'images', 'txt', 'typography', 'text', 'animation', 'animated', 'build', 'complex', 'effect', | |
| 65 | + 'interactive', 'click', 'target', 'point', 'builder', 'link', 'point', 'points', 'color', 'mouse', 'hover', | |
| 66 | + 'over', 'hover over', 'picture', 'font', 'size', 'heading', | |
| 67 | + 'header', 'paragraph', 'section', 'article', 'particle', 'document', 'writing', 'style', 'format', 'complex', | |
| 68 | + 'auto', 'scroll', 'scrolling', 'auto-scroll', 'auto-scrolling', 'head', 'heading', 'title', 'subtitle']; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public function get_custom_help_url() | |
| 72 | + { | |
| 73 | + return 'mailto:[email protected]?subject=Bug Report - King Addons&body=Please describe the issue'; | |
| 74 | + } | |
| 75 | + | |
| 76 | + protected function register_controls(): void | |
| 77 | + { | |
| 78 | + /** START TAB: CONTENT ===================== */ | |
| 79 | + /** SECTION: Texts ===================== */ | |
| 80 | + $this->start_controls_section( | |
| 81 | + 'kng_auto_scroll_txt_content_section_content', | |
| 82 | + [ | |
| 83 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Content', 'king-addons'), | |
| 84 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 85 | + ] | |
| 86 | + ); | |
| 87 | + | |
| 88 | + $repeater = new Repeater(); | |
| 89 | + | |
| 90 | + $repeater->add_control( | |
| 91 | + 'kng_auto_scroll_txt_content_type', | |
| 92 | + [ | |
| 93 | + 'label' => '<b>' . esc_html__('Type of content', 'king-addons') . '</b>', | |
| 94 | + 'type' => Controls_Manager::SELECT, | |
| 95 | + 'options' => [ | |
| 96 | + 'text' => esc_html__('Text', 'king-addons'), | |
| 97 | + 'image' => esc_html__('Image', 'king-addons'), | |
| 98 | + ], | |
| 99 | + 'default' => 'text', | |
| 100 | + 'separator' => 'after', | |
| 101 | + ] | |
| 102 | + ); | |
| 103 | + | |
| 104 | + $repeater->add_group_control( | |
| 105 | + Group_Control_Typography::get_type(), | |
| 106 | + [ | |
| 107 | + 'label' => esc_html__('Typography', 'king-addons'), | |
| 108 | + 'name' => 'kng_auto_scroll_txt_typography', | |
| 109 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text', | |
| 110 | + 'condition' => [ | |
| 111 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 112 | + ] | |
| 113 | + ] | |
| 114 | + ); | |
| 115 | + | |
| 116 | + $repeater->add_control( | |
| 117 | + 'kng_auto_scroll_txt_color', | |
| 118 | + [ | |
| 119 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 120 | + 'type' => Controls_Manager::COLOR, | |
| 121 | + 'selectors' => [ | |
| 122 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'color: {{VALUE}};', | |
| 123 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text a' => 'color: {{VALUE}};', | |
| 124 | + ], | |
| 125 | + 'condition' => [ | |
| 126 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 127 | + ] | |
| 128 | + ] | |
| 129 | + ); | |
| 130 | + | |
| 131 | + $repeater->add_group_control( | |
| 132 | + Group_Control_Background::get_type(), | |
| 133 | + [ | |
| 134 | + 'name' => 'kng_auto_scroll_txt_bg_color', | |
| 135 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text', | |
| 136 | + 'condition' => [ | |
| 137 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 138 | + ], | |
| 139 | + 'separator' => 'before', | |
| 140 | + ] | |
| 141 | + ); | |
| 142 | + | |
| 143 | + $repeater->add_control( | |
| 144 | + 'kng_auto_scroll_txt_custom_vertical_align', | |
| 145 | + [ | |
| 146 | + 'label' => esc_html__('Custom Vertical Align', 'king-addons'), | |
| 147 | + 'type' => Controls_Manager::SWITCHER, | |
| 148 | + 'condition' => [ | |
| 149 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 150 | + ], | |
| 151 | + 'separator' => 'before', | |
| 152 | + ] | |
| 153 | + ); | |
| 154 | + | |
| 155 | + $repeater->add_responsive_control( | |
| 156 | + 'kng_auto_scroll_txt_vertical_align', | |
| 157 | + [ | |
| 158 | + 'label' => esc_html__('Vertical Align', 'king-addons'), | |
| 159 | + 'type' => Controls_Manager::SELECT, | |
| 160 | + 'options' => [ | |
| 161 | + 'baseline' => esc_html__('baseline', 'king-addons'), | |
| 162 | + 'top' => esc_html__('top', 'king-addons'), | |
| 163 | + 'bottom' => esc_html__('bottom', 'king-addons'), | |
| 164 | + 'sub' => esc_html__('sub', 'king-addons'), | |
| 165 | + 'super' => esc_html__('super', 'king-addons'), | |
| 166 | + 'text-top' => esc_html__('text-top', 'king-addons'), | |
| 167 | + 'text-bottom' => esc_html__('text-bottom', 'king-addons'), | |
| 168 | + 'middle' => esc_html__('middle', 'king-addons'), | |
| 169 | + ], | |
| 170 | + 'default' => 'baseline', | |
| 171 | + 'selectors' => [ | |
| 172 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'vertical-align: {{VALUE}};', | |
| 173 | + ], | |
| 174 | + 'condition' => [ | |
| 175 | + 'kng_auto_scroll_txt_custom_vertical_align!' => '', | |
| 176 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 177 | + ] | |
| 178 | + ] | |
| 179 | + ); | |
| 180 | + | |
| 181 | + $repeater->add_control( | |
| 182 | + 'kng_auto_scroll_txt_padding_switcher', | |
| 183 | + [ | |
| 184 | + 'label' => esc_html__('Custom Padding', 'king-addons'), | |
| 185 | + 'type' => Controls_Manager::SWITCHER, | |
| 186 | + 'condition' => [ | |
| 187 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 188 | + ] | |
| 189 | + ] | |
| 190 | + ); | |
| 191 | + | |
| 192 | + $repeater->add_responsive_control( | |
| 193 | + 'kng_auto_scroll_txt_padding', | |
| 194 | + [ | |
| 195 | + 'label' => esc_html__('Padding', 'king-addons'), | |
| 196 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 197 | + 'size_units' => ['px', 'em', '%'], | |
| 198 | + 'default' => [ | |
| 199 | + 'top' => 0, | |
| 200 | + 'right' => 0, | |
| 201 | + 'bottom' => 0, | |
| 202 | + 'left' => 0, | |
| 203 | + ], | |
| 204 | + 'selectors' => [ | |
| 205 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 206 | + ], | |
| 207 | + 'condition' => [ | |
| 208 | + 'kng_auto_scroll_txt_padding_switcher!' => '', | |
| 209 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 210 | + ] | |
| 211 | + ] | |
| 212 | + ); | |
| 213 | + | |
| 214 | + $repeater->add_control( | |
| 215 | + 'kng_auto_scroll_txt_margin_switcher', | |
| 216 | + [ | |
| 217 | + 'label' => esc_html__('Custom Margin', 'king-addons'), | |
| 218 | + 'type' => Controls_Manager::SWITCHER, | |
| 219 | + 'condition' => [ | |
| 220 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 221 | + ] | |
| 222 | + ] | |
| 223 | + ); | |
| 224 | + | |
| 225 | + $repeater->add_responsive_control( | |
| 226 | + 'kng_auto_scroll_txt_margin_left', | |
| 227 | + [ | |
| 228 | + 'label' => esc_html__('Margin Left', 'king-addons'), | |
| 229 | + 'type' => Controls_Manager::NUMBER, | |
| 230 | + 'step' => 1, | |
| 231 | + 'selectors' => [ | |
| 232 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'margin-left: {{SIZE}}px;', | |
| 233 | + ], | |
| 234 | + 'condition' => [ | |
| 235 | + 'kng_auto_scroll_txt_margin_switcher!' => '', | |
| 236 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 237 | + ] | |
| 238 | + ] | |
| 239 | + ); | |
| 240 | + | |
| 241 | + $repeater->add_responsive_control( | |
| 242 | + 'kng_auto_scroll_txt_margin_right', | |
| 243 | + [ | |
| 244 | + 'label' => esc_html__('Margin Right', 'king-addons'), | |
| 245 | + 'type' => Controls_Manager::NUMBER, | |
| 246 | + 'step' => 1, | |
| 247 | + 'selectors' => [ | |
| 248 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'margin-right: {{SIZE}}px;', | |
| 249 | + ], | |
| 250 | + 'condition' => [ | |
| 251 | + 'kng_auto_scroll_txt_margin_switcher!' => '', | |
| 252 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 253 | + ] | |
| 254 | + ] | |
| 255 | + ); | |
| 256 | + | |
| 257 | + $repeater->add_control( | |
| 258 | + 'kng_auto_scroll_txt_margin_info', | |
| 259 | + [ | |
| 260 | + 'type' => Controls_Manager::ALERT, | |
| 261 | + 'alert_type' => 'info', | |
| 262 | + 'content' => esc_html__('For vertical spacing use the line-height parameter in Typography, or optionally Custom Padding - top and bottom. Margin top and bottom parameters are available when Custom Width value is set. This is because of current HTML/CSS limitations for multiline text.', 'king-addons'), | |
| 263 | + 'condition' => [ | |
| 264 | + 'kng_auto_scroll_txt_margin_switcher!' => '', | |
| 265 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 266 | + ] | |
| 267 | + ] | |
| 268 | + ); | |
| 269 | + | |
| 270 | + $repeater->add_control( | |
| 271 | + 'kng_auto_scroll_txt_custom_border', | |
| 272 | + [ | |
| 273 | + 'label' => esc_html__('Custom Border', 'king-addons'), | |
| 274 | + 'type' => Controls_Manager::SWITCHER, | |
| 275 | + 'condition' => [ | |
| 276 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 277 | + ] | |
| 278 | + ] | |
| 279 | + ); | |
| 280 | + | |
| 281 | + $repeater->add_group_control( | |
| 282 | + Group_Control_Border::get_type(), | |
| 283 | + [ | |
| 284 | + 'name' => 'kng_auto_scroll_txt_border', | |
| 285 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text', | |
| 286 | + 'condition' => [ | |
| 287 | + 'kng_auto_scroll_txt_custom_border!' => '', | |
| 288 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 289 | + ] | |
| 290 | + ] | |
| 291 | + ); | |
| 292 | + | |
| 293 | + $repeater->add_responsive_control( | |
| 294 | + 'kng_auto_scroll_txt_border_radius', | |
| 295 | + [ | |
| 296 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 297 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 298 | + 'size_units' => ['px', '%'], | |
| 299 | + 'default' => [ | |
| 300 | + 'top' => 0, | |
| 301 | + 'right' => 0, | |
| 302 | + 'bottom' => 0, | |
| 303 | + 'left' => 0, | |
| 304 | + ], | |
| 305 | + 'selectors' => [ | |
| 306 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 307 | + ], | |
| 308 | + 'condition' => [ | |
| 309 | + 'kng_auto_scroll_txt_custom_border!' => '', | |
| 310 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 311 | + ] | |
| 312 | + ] | |
| 313 | + ); | |
| 314 | + | |
| 315 | + $repeater->add_control( | |
| 316 | + 'kng_auto_scroll_txt_custom_width_switcher', | |
| 317 | + [ | |
| 318 | + 'label' => esc_html__('Custom Width', 'king-addons'), | |
| 319 | + 'type' => Controls_Manager::SWITCHER, | |
| 320 | + 'condition' => [ | |
| 321 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 322 | + ] | |
| 323 | + ] | |
| 324 | + ); | |
| 325 | + | |
| 326 | + $repeater->add_responsive_control( | |
| 327 | + 'kng_auto_scroll_txt_custom_width', | |
| 328 | + [ | |
| 329 | + 'label' => esc_html__('Width (px)', 'king-addons'), | |
| 330 | + 'description' => esc_html__('The custom width of the current content item is useful for creating multiline text snippets or limiting the image size.', 'king-addons'), | |
| 331 | + 'type' => Controls_Manager::NUMBER, | |
| 332 | + 'min' => 0, | |
| 333 | + 'step' => 1, | |
| 334 | + 'selectors' => [ | |
| 335 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'width: {{SIZE}}px; display: inline-block;', | |
| 336 | + ], | |
| 337 | + 'condition' => [ | |
| 338 | + 'kng_auto_scroll_txt_custom_width_switcher!' => '', | |
| 339 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 340 | + ] | |
| 341 | + ] | |
| 342 | + ); | |
| 343 | + | |
| 344 | + $repeater->add_responsive_control( | |
| 345 | + 'kng_auto_scroll_txt_margin_top', | |
| 346 | + [ | |
| 347 | + 'label' => esc_html__('Margin Top', 'king-addons'), | |
| 348 | + 'type' => Controls_Manager::NUMBER, | |
| 349 | + 'step' => 1, | |
| 350 | + 'selectors' => [ | |
| 351 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'margin-top: {{SIZE}}px;', | |
| 352 | + ], | |
| 353 | + 'condition' => [ | |
| 354 | + 'kng_auto_scroll_txt_custom_width_switcher!' => '', | |
| 355 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 356 | + ] | |
| 357 | + ] | |
| 358 | + ); | |
| 359 | + | |
| 360 | + $repeater->add_responsive_control( | |
| 361 | + 'kng_auto_scroll_txt_margin_bottom', | |
| 362 | + [ | |
| 363 | + 'label' => esc_html__('Margin Bottom', 'king-addons'), | |
| 364 | + 'type' => Controls_Manager::NUMBER, | |
| 365 | + 'step' => 1, | |
| 366 | + 'selectors' => [ | |
| 367 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'margin-bottom: {{SIZE}}px;', | |
| 368 | + ], | |
| 369 | + 'condition' => [ | |
| 370 | + 'kng_auto_scroll_txt_custom_width_switcher!' => '', | |
| 371 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 372 | + ] | |
| 373 | + ] | |
| 374 | + ); | |
| 375 | + | |
| 376 | + /** ====================================================== */ | |
| 377 | + /** TEXT EFFECTS ========================================== */ | |
| 378 | + $repeater->add_control( | |
| 379 | + 'kng_auto_scroll_txt_effect', | |
| 380 | + [ | |
| 381 | + 'label' => '<b>' . esc_html__('Text Effect', 'king-addons') . '</b>', | |
| 382 | + 'type' => Controls_Manager::SELECT, | |
| 383 | + 'options' => [ | |
| 384 | + 'none' => esc_html__('None', 'king-addons'), | |
| 385 | + 'text-gradient' => esc_html__('Text Gradient', 'king-addons'), | |
| 386 | + 'underline-gradient' => esc_html__('Underline Gradient', 'king-addons'), | |
| 387 | + 'outline-stroke' => esc_html__('Outline Stroke', 'king-addons'), | |
| 388 | + ], | |
| 389 | + 'label_block' => true, | |
| 390 | + 'default' => 'none', | |
| 391 | + 'separator' => 'before', | |
| 392 | + 'condition' => [ | |
| 393 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 394 | + ] | |
| 395 | + ] | |
| 396 | + ); | |
| 397 | + | |
| 398 | + /** Outline Stroke ========================================== */ | |
| 399 | + $repeater->add_control( | |
| 400 | + 'kng_auto_scroll_txt_effect_stroke_txt_color', | |
| 401 | + [ | |
| 402 | + 'label' => esc_html__('Text Color', 'king-addons'), | |
| 403 | + 'type' => Controls_Manager::COLOR, | |
| 404 | + 'default' => '#0000', | |
| 405 | + 'selectors' => [ | |
| 406 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner span' => 'color: {{VALUE}};' | |
| 407 | + ], | |
| 408 | + 'condition' => [ | |
| 409 | + 'kng_auto_scroll_txt_effect' => 'outline-stroke', | |
| 410 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 411 | + ] | |
| 412 | + ] | |
| 413 | + ); | |
| 414 | + | |
| 415 | + $repeater->add_control( | |
| 416 | + 'kng_auto_scroll_txt_effect_stroke_stroke_color', | |
| 417 | + [ | |
| 418 | + 'label' => esc_html__('Stroke Color', 'king-addons'), | |
| 419 | + 'type' => Controls_Manager::COLOR, | |
| 420 | + 'default' => '#dbdbdb', | |
| 421 | + 'selectors' => [ | |
| 422 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner span' => '-webkit-text-stroke-color: {{VALUE}};' | |
| 423 | + ], | |
| 424 | + 'condition' => [ | |
| 425 | + 'kng_auto_scroll_txt_effect' => 'outline-stroke', | |
| 426 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 427 | + ] | |
| 428 | + ] | |
| 429 | + ); | |
| 430 | + | |
| 431 | + $repeater->add_control( | |
| 432 | + 'kng_auto_scroll_txt_effect_stroke_width', | |
| 433 | + [ | |
| 434 | + 'label' => esc_html__('Stroke Width (px)', 'king-addons'), | |
| 435 | + 'type' => Controls_Manager::NUMBER, | |
| 436 | + 'min' => 1, | |
| 437 | + 'step' => 1, | |
| 438 | + 'default' => 1, | |
| 439 | + 'selectors' => [ | |
| 440 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner span' => '-webkit-text-stroke-width: {{SIZE}}px;', | |
| 441 | + ], | |
| 442 | + 'condition' => [ | |
| 443 | + 'kng_auto_scroll_txt_effect' => 'outline-stroke', | |
| 444 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 445 | + ] | |
| 446 | + ] | |
| 447 | + ); | |
| 448 | + /** END Outline Stroke ========================================== */ | |
| 449 | + | |
| 450 | + /** Text Gradient ========================================== */ | |
| 451 | + $repeater->add_group_control( | |
| 452 | + Group_Control_Background::get_type(), | |
| 453 | + [ | |
| 454 | + 'name' => 'kng_auto_scroll_txt_effect_gradient', | |
| 455 | + 'types' => ['gradient'], | |
| 456 | + 'fields_options' => [ | |
| 457 | + 'color' => [ | |
| 458 | + 'default' => '#574ff7', | |
| 459 | + ], | |
| 460 | + 'background' => [ | |
| 461 | + 'default' => 'gradient', | |
| 462 | + ] | |
| 463 | + ], | |
| 464 | + 'exclude' => ['classic', 'image'], | |
| 465 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner', | |
| 466 | + 'condition' => [ | |
| 467 | + 'kng_auto_scroll_txt_effect' => 'text-gradient', | |
| 468 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 469 | + ] | |
| 470 | + ] | |
| 471 | + ); | |
| 472 | + /** END: Text Gradient ========================================== */ | |
| 473 | + | |
| 474 | + /** Underline Gradient ========================================== */ | |
| 475 | + $repeater->add_group_control( | |
| 476 | + Group_Control_Background::get_type(), | |
| 477 | + [ | |
| 478 | + 'name' => 'kng_auto_scroll_txt_underline_effects_gradient', | |
| 479 | + 'types' => ['gradient'], | |
| 480 | + 'fields_options' => [ | |
| 481 | + 'color' => [ | |
| 482 | + 'default' => '#84fab0', | |
| 483 | + ], | |
| 484 | + 'color_b' => [ | |
| 485 | + 'default' => '#8fd3f4', | |
| 486 | + ], | |
| 487 | + 'background' => [ | |
| 488 | + 'default' => 'gradient', | |
| 489 | + ], | |
| 490 | + 'gradient_type' => [ | |
| 491 | + 'default' => 'linear' | |
| 492 | + ], | |
| 493 | + 'gradient_angle' => [ | |
| 494 | + 'default' => [ | |
| 495 | + 'unit' => 'deg', | |
| 496 | + 'size' => 120, | |
| 497 | + ], | |
| 498 | + ] | |
| 499 | + ], | |
| 500 | + 'exclude' => ['classic', 'image'], | |
| 501 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner', | |
| 502 | + 'condition' => [ | |
| 503 | + 'kng_auto_scroll_txt_effect' => 'underline-gradient', | |
| 504 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 505 | + ] | |
| 506 | + ] | |
| 507 | + ); | |
| 508 | + | |
| 509 | + $repeater->add_control( | |
| 510 | + 'kng_auto_scroll_txt_underline_effects_bg_position', | |
| 511 | + [ | |
| 512 | + 'label' => esc_html__('Vertical Position (%)', 'king-addons'), | |
| 513 | + 'type' => Controls_Manager::SLIDER, | |
| 514 | + 'size_units' => ['%'], | |
| 515 | + 'range' => [ | |
| 516 | + '%' => [ | |
| 517 | + 'min' => 0, | |
| 518 | + 'max' => 100, | |
| 519 | + 'step' => 1, | |
| 520 | + ], | |
| 521 | + ], | |
| 522 | + 'default' => [ | |
| 523 | + 'unit' => '%', | |
| 524 | + 'size' => 88, | |
| 525 | + ], | |
| 526 | + 'separator' => 'before', | |
| 527 | + 'selectors' => [ | |
| 528 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner' => 'background-position: 0 {{SIZE}}{{UNIT}}; background-repeat: no-repeat;', | |
| 529 | + ], | |
| 530 | + 'condition' => [ | |
| 531 | + 'kng_auto_scroll_txt_effect' => 'underline-gradient', | |
| 532 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 533 | + ] | |
| 534 | + ] | |
| 535 | + ); | |
| 536 | + | |
| 537 | + $repeater->add_control( | |
| 538 | + 'kng_auto_scroll_txt_underline_effects_bg_height', | |
| 539 | + [ | |
| 540 | + 'label' => esc_html__('Height (%)', 'king-addons'), | |
| 541 | + 'type' => Controls_Manager::SLIDER, | |
| 542 | + 'size_units' => ['%'], | |
| 543 | + 'range' => [ | |
| 544 | + '%' => [ | |
| 545 | + 'min' => 0, | |
| 546 | + 'max' => 100, | |
| 547 | + 'step' => 1, | |
| 548 | + ], | |
| 549 | + ], | |
| 550 | + 'default' => [ | |
| 551 | + 'unit' => '%', | |
| 552 | + 'size' => 20, | |
| 553 | + ], | |
| 554 | + 'selectors' => [ | |
| 555 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner' => 'background-size: 100% {{SIZE}}{{UNIT}};', | |
| 556 | + ], | |
| 557 | + 'condition' => [ | |
| 558 | + 'kng_auto_scroll_txt_effect' => 'underline-gradient', | |
| 559 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 560 | + ] | |
| 561 | + ] | |
| 562 | + ); | |
| 563 | + | |
| 564 | + $repeater->add_control( | |
| 565 | + 'kng_auto_scroll_txt_underline_effects_bg_height_hover', | |
| 566 | + [ | |
| 567 | + 'label' => esc_html__('Height on mouse hover (%)', 'king-addons'), | |
| 568 | + 'type' => Controls_Manager::SLIDER, | |
| 569 | + 'size_units' => ['%'], | |
| 570 | + 'range' => [ | |
| 571 | + '%' => [ | |
| 572 | + 'min' => 0, | |
| 573 | + 'max' => 100, | |
| 574 | + 'step' => 1, | |
| 575 | + ], | |
| 576 | + ], | |
| 577 | + 'default' => [ | |
| 578 | + 'unit' => '%', | |
| 579 | + 'size' => 88, | |
| 580 | + ], | |
| 581 | + 'selectors' => [ | |
| 582 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner:hover' => 'background-size: 100% {{SIZE}}{{UNIT}};', | |
| 583 | + ], | |
| 584 | + 'condition' => [ | |
| 585 | + 'kng_auto_scroll_txt_effect' => 'underline-gradient', | |
| 586 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 587 | + ] | |
| 588 | + ] | |
| 589 | + ); | |
| 590 | + | |
| 591 | + /** END: Underline Gradient ========================================== */ | |
| 592 | + | |
| 593 | + /** END: TEXT EFFECTS ========================================== */ | |
| 594 | + /** =========================================================== */ | |
| 595 | + | |
| 596 | + $repeater->add_control( | |
| 597 | + 'kng_auto_scroll_txt_content', | |
| 598 | + [ | |
| 599 | + 'label' => '<b>' . esc_html__('Text', 'king-addons') . '</b>', | |
| 600 | + 'type' => Controls_Manager::TEXTAREA, | |
| 601 | + 'default' => esc_html__('Text', 'king-addons'), | |
| 602 | + 'condition' => [ | |
| 603 | + 'kng_auto_scroll_txt_content_type' => 'text' | |
| 604 | + ], | |
| 605 | + 'separator' => 'before', | |
| 606 | + ] | |
| 607 | + ); | |
| 608 | + /** END: Content Type TEXT ========================================== */ | |
| 609 | + | |
| 610 | + /** Content Type IMAGE ========================================== */ | |
| 611 | + $repeater->add_control( | |
| 612 | + 'kng_auto_scroll_txt_image', | |
| 613 | + [ | |
| 614 | + 'label' => esc_html__('Image', 'king-addons'), | |
| 615 | + 'type' => Controls_Manager::MEDIA, | |
| 616 | + 'default' => [ | |
| 617 | + 'url' => Utils::get_placeholder_image_src(), | |
| 618 | + ], | |
| 619 | + 'condition' => [ | |
| 620 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 621 | + ] | |
| 622 | + ] | |
| 623 | + ); | |
| 624 | + | |
| 625 | + $repeater->add_group_control( | |
| 626 | + Group_Control_Image_Size::get_type(), | |
| 627 | + [ | |
| 628 | + 'name' => 'kng_auto_scroll_txt_image_size', | |
| 629 | + 'default' => 'full', | |
| 630 | + 'separator' => 'before', | |
| 631 | + 'condition' => [ | |
| 632 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 633 | + ] | |
| 634 | + ] | |
| 635 | + ); | |
| 636 | + | |
| 637 | + $repeater->add_responsive_control( | |
| 638 | + 'kng_image_comparison_box_max_width', | |
| 639 | + [ | |
| 640 | + 'label' => esc_html__('Width (px)', 'king-addons'), | |
| 641 | + 'type' => Controls_Manager::NUMBER, | |
| 642 | + 'min' => 0, | |
| 643 | + 'step' => 1, | |
| 644 | + 'default' => 50, | |
| 645 | + 'selectors' => [ | |
| 646 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text img' => 'width: {{SIZE}}px;' | |
| 647 | + ], | |
| 648 | + 'condition' => [ | |
| 649 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 650 | + ] | |
| 651 | + ] | |
| 652 | + ); | |
| 653 | + | |
| 654 | + $repeater->add_group_control( | |
| 655 | + Group_Control_Box_Shadow::get_type(), | |
| 656 | + [ | |
| 657 | + 'name' => 'kng_auto_scroll_txt_image_shadow', | |
| 658 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text img', | |
| 659 | + 'condition' => [ | |
| 660 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 661 | + ] | |
| 662 | + ] | |
| 663 | + ); | |
| 664 | + | |
| 665 | + $repeater->add_group_control( | |
| 666 | + Group_Control_Border::get_type(), | |
| 667 | + [ | |
| 668 | + 'name' => 'kng_auto_scroll_txt_image_border', | |
| 669 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text img', | |
| 670 | + 'condition' => [ | |
| 671 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 672 | + ] | |
| 673 | + ] | |
| 674 | + ); | |
| 675 | + | |
| 676 | + $repeater->add_responsive_control( | |
| 677 | + 'kng_auto_scroll_txt_image_border_radius', | |
| 678 | + [ | |
| 679 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 680 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 681 | + 'size_units' => ['px', '%'], | |
| 682 | + 'selectors' => [ | |
| 683 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 684 | + ], | |
| 685 | + 'condition' => [ | |
| 686 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 687 | + ] | |
| 688 | + ] | |
| 689 | + ); | |
| 690 | + | |
| 691 | + $repeater->add_control( | |
| 692 | + 'kng_auto_scroll_txt_image_custom_vertical_align', | |
| 693 | + [ | |
| 694 | + 'label' => esc_html__('Custom Vertical Align', 'king-addons'), | |
| 695 | + 'type' => Controls_Manager::SWITCHER, | |
| 696 | + 'condition' => [ | |
| 697 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 698 | + ] | |
| 699 | + ] | |
| 700 | + ); | |
| 701 | + | |
| 702 | + $repeater->add_responsive_control( | |
| 703 | + 'kng_auto_scroll_txt_image_vertical_align', | |
| 704 | + [ | |
| 705 | + 'label' => esc_html__('Vertical Align', 'king-addons'), | |
| 706 | + 'type' => Controls_Manager::SELECT, | |
| 707 | + 'options' => [ | |
| 708 | + 'baseline' => esc_html__('baseline', 'king-addons'), | |
| 709 | + 'top' => esc_html__('top', 'king-addons'), | |
| 710 | + 'bottom' => esc_html__('bottom', 'king-addons'), | |
| 711 | + 'sub' => esc_html__('sub', 'king-addons'), | |
| 712 | + 'super' => esc_html__('super', 'king-addons'), | |
| 713 | + 'text-top' => esc_html__('text-top', 'king-addons'), | |
| 714 | + 'text-bottom' => esc_html__('text-bottom', 'king-addons'), | |
| 715 | + 'middle' => esc_html__('middle', 'king-addons'), | |
| 716 | + ], | |
| 717 | + 'default' => 'baseline', | |
| 718 | + 'selectors' => [ | |
| 719 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text img' => 'vertical-align: {{VALUE}};', | |
| 720 | + ], | |
| 721 | + 'condition' => [ | |
| 722 | + 'kng_auto_scroll_txt_image_custom_vertical_align!' => '', | |
| 723 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 724 | + ] | |
| 725 | + ] | |
| 726 | + ); | |
| 727 | + | |
| 728 | + $repeater->add_control( | |
| 729 | + 'kng_auto_scroll_txt_image_margin_switcher', | |
| 730 | + [ | |
| 731 | + 'label' => esc_html__('Custom Margin', 'king-addons'), | |
| 732 | + 'type' => Controls_Manager::SWITCHER, | |
| 733 | + 'condition' => [ | |
| 734 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 735 | + ] | |
| 736 | + ] | |
| 737 | + ); | |
| 738 | + | |
| 739 | + $repeater->add_responsive_control( | |
| 740 | + 'kng_auto_scroll_txt_image_margin', | |
| 741 | + [ | |
| 742 | + 'label' => esc_html__('Margin', 'king-addons'), | |
| 743 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 744 | + 'size_units' => ['px', '%'], | |
| 745 | + 'default' => [ | |
| 746 | + 'top' => 0, | |
| 747 | + 'right' => 0, | |
| 748 | + 'bottom' => 0, | |
| 749 | + 'left' => 0, | |
| 750 | + ], | |
| 751 | + 'selectors' => [ | |
| 752 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'margin: 0;', | |
| 753 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 754 | + ], | |
| 755 | + 'condition' => [ | |
| 756 | + 'kng_auto_scroll_txt_image_margin_switcher!' => '', | |
| 757 | + 'kng_auto_scroll_txt_content_type' => 'image' | |
| 758 | + ] | |
| 759 | + ] | |
| 760 | + ); | |
| 761 | + /** END: Content Type IMAGE ========================================== */ | |
| 762 | + | |
| 763 | + $repeater->add_control( | |
| 764 | + 'kng_auto_scroll_txt_content_common_for_all_types_head', | |
| 765 | + [ | |
| 766 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Common for all types', 'king-addons'), | |
| 767 | + 'type' => Controls_Manager::HEADING, | |
| 768 | + ] | |
| 769 | + ); | |
| 770 | + | |
| 771 | + $repeater->add_control( | |
| 772 | + 'kng_auto_scroll_txt_custom_css_class_switcher', | |
| 773 | + [ | |
| 774 | + 'label' => esc_html__('Custom CSS Class', 'king-addons'), | |
| 775 | + 'type' => Controls_Manager::SWITCHER, | |
| 776 | + ] | |
| 777 | + ); | |
| 778 | + | |
| 779 | + $repeater->add_control( | |
| 780 | + 'kng_auto_scroll_txt_custom_css_class', | |
| 781 | + [ | |
| 782 | + 'label' => esc_html__('CSS Class', 'king-addons'), | |
| 783 | + 'type' => Controls_Manager::TEXT, | |
| 784 | + 'placeholder' => esc_html__('Type or paste the class', 'king-addons'), | |
| 785 | + 'ai' => [ | |
| 786 | + 'active' => false, | |
| 787 | + ], | |
| 788 | + 'separator' => 'after', | |
| 789 | + 'condition' => [ | |
| 790 | + 'kng_auto_scroll_txt_custom_css_class_switcher!' => '', | |
| 791 | + ] | |
| 792 | + ] | |
| 793 | + ); | |
| 794 | + | |
| 795 | + $repeater->add_control( | |
| 796 | + 'kng_auto_scroll_txt_transform_switcher', | |
| 797 | + [ | |
| 798 | + 'label' => esc_html__('Transform', 'king-addons'), | |
| 799 | + 'type' => Controls_Manager::SWITCHER, | |
| 800 | + ] | |
| 801 | + ); | |
| 802 | + | |
| 803 | + $repeater->add_responsive_control( | |
| 804 | + 'kng_auto_scroll_txt_transform_rotate', | |
| 805 | + [ | |
| 806 | + 'label' => esc_html__('Rotate', 'king-addons') . ' (deg)', | |
| 807 | + 'type' => Controls_Manager::NUMBER, | |
| 808 | + 'min' => -360, | |
| 809 | + 'max' => 360, | |
| 810 | + 'step' => 5, | |
| 811 | + 'default' => 0, | |
| 812 | + 'selectors' => [ | |
| 813 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner' => 'transform: rotateZ({{SIZE}}deg); display: inline-block;', | |
| 814 | + ], | |
| 815 | + 'condition' => [ | |
| 816 | + 'kng_auto_scroll_txt_transform_switcher!' => '', | |
| 817 | + ], | |
| 818 | + 'frontend_available' => true, | |
| 819 | + ] | |
| 820 | + ); | |
| 821 | + | |
| 822 | + $repeater->add_responsive_control( | |
| 823 | + 'kng_auto_scroll_txt_transform_offset_X', | |
| 824 | + [ | |
| 825 | + 'label' => esc_html__('Offset X', 'king-addons'), | |
| 826 | + 'type' => Controls_Manager::SLIDER, | |
| 827 | + 'size_units' => ['px', '%', 'em', 'rem', 'vw', 'custom'], | |
| 828 | + 'range' => [ | |
| 829 | + '%' => [ | |
| 830 | + 'min' => -100, | |
| 831 | + 'max' => 100, | |
| 832 | + ], | |
| 833 | + 'px' => [ | |
| 834 | + 'min' => -1000, | |
| 835 | + 'max' => 1000, | |
| 836 | + ], | |
| 837 | + ], | |
| 838 | + 'condition' => [ | |
| 839 | + 'kng_auto_scroll_txt_transform_switcher!' => '', | |
| 840 | + ], | |
| 841 | + 'selectors' => [ | |
| 842 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner span' => 'transform: translateX({{SIZE}}{{UNIT}}); display: inline-block;', | |
| 843 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text .king-addons-auto-scrolling-text-inner img' => 'transform: translateX({{SIZE}}{{UNIT}}); display: inline-block;', | |
| 844 | + ], | |
| 845 | + 'frontend_available' => true, | |
| 846 | + ] | |
| 847 | + ); | |
| 848 | + | |
| 849 | + $repeater->add_responsive_control( | |
| 850 | + 'kng_auto_scroll_txt_transform_offset_Y', | |
| 851 | + [ | |
| 852 | + 'label' => esc_html__('Offset Y', 'king-addons'), | |
| 853 | + 'type' => Controls_Manager::SLIDER, | |
| 854 | + 'size_units' => ['px', '%', 'em', 'rem', 'vh', 'custom'], | |
| 855 | + 'range' => [ | |
| 856 | + '%' => [ | |
| 857 | + 'min' => -100, | |
| 858 | + 'max' => 100, | |
| 859 | + ], | |
| 860 | + 'px' => [ | |
| 861 | + 'min' => -1000, | |
| 862 | + 'max' => 1000, | |
| 863 | + ], | |
| 864 | + ], | |
| 865 | + 'condition' => [ | |
| 866 | + 'kng_auto_scroll_txt_transform_switcher!' => '', | |
| 867 | + ], | |
| 868 | + 'selectors' => [ | |
| 869 | + '{{WRAPPER}} {{CURRENT_ITEM}}.king-addons-auto-scrolling-text' => 'transform: translateY({{SIZE}}{{UNIT}}); display: inline-block;', | |
| 870 | + ], | |
| 871 | + 'frontend_available' => true, | |
| 872 | + ] | |
| 873 | + ); | |
| 874 | + | |
| 875 | + $repeater->add_control( | |
| 876 | + 'kng_auto_scroll_txt_link_switcher', | |
| 877 | + [ | |
| 878 | + 'label' => esc_html__('Link', 'king-addons'), | |
| 879 | + 'type' => Controls_Manager::SWITCHER, | |
| 880 | + ] | |
| 881 | + ); | |
| 882 | + | |
| 883 | + $repeater->add_control( | |
| 884 | + 'kng_auto_scroll_txt_link', | |
| 885 | + [ | |
| 886 | + 'label' => esc_html__('Link', 'king-addons'), | |
| 887 | + 'type' => Controls_Manager::URL, | |
| 888 | + 'condition' => [ | |
| 889 | + 'kng_auto_scroll_txt_link_switcher!' => '', | |
| 890 | + ] | |
| 891 | + ] | |
| 892 | + ); | |
| 893 | + | |
| 894 | + $this->add_control( | |
| 895 | + 'kng_auto_scroll_txt_content_items', | |
| 896 | + [ | |
| 897 | + 'type' => Controls_Manager::REPEATER, | |
| 898 | + 'fields' => $repeater->get_controls(), | |
| 899 | + 'default' => [ | |
| 900 | + [ | |
| 901 | + 'kng_auto_scroll_txt_content_type' => 'text', | |
| 902 | + 'kng_auto_scroll_txt_content' => esc_html__('King Addons', 'king-addons'), | |
| 903 | + ], | |
| 904 | + [ | |
| 905 | + 'kng_auto_scroll_txt_content_type' => 'text', | |
| 906 | + 'kng_auto_scroll_txt_content' => esc_html__('King Addons', 'king-addons'), | |
| 907 | + ], | |
| 908 | + [ | |
| 909 | + 'kng_auto_scroll_txt_content_type' => 'text', | |
| 910 | + 'kng_auto_scroll_txt_content' => esc_html__('King Addons', 'king-addons'), | |
| 911 | + ] | |
| 912 | + ], | |
| 913 | + 'title_field' => '<# if( "text" === kng_auto_scroll_txt_content_type ) { #> {{kng_auto_scroll_txt_content}} <# } else if( "image" === kng_auto_scroll_txt_content_type) {#> <img class="king-addons-repeater-list-img-icon" src="{{kng_auto_scroll_txt_image.url}}"> <# } #>', | |
| 914 | + ] | |
| 915 | + ); | |
| 916 | + | |
| 917 | + $this->end_controls_section(); | |
| 918 | + /** END SECTION: Texts ===================== */ | |
| 919 | + | |
| 920 | + /** SECTION: Carousel Settings */ | |
| 921 | + $this->start_controls_section( | |
| 922 | + 'kng_auto_scroll_txt_content_section_caousel_settings', | |
| 923 | + [ | |
| 924 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Carousel Settings', 'king-addons'), | |
| 925 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 926 | + ] | |
| 927 | + ); | |
| 928 | + | |
| 929 | + $this->add_responsive_control( | |
| 930 | + 'kng_auto_scroll_txt_space_between_items', | |
| 931 | + [ | |
| 932 | + 'label' => esc_html__('Space between items (px)', 'king-addons'), | |
| 933 | + 'type' => Controls_Manager::NUMBER, | |
| 934 | + 'min' => 0, | |
| 935 | + 'step' => 1, | |
| 936 | + 'default' => 50, | |
| 937 | + 'selectors' => [ | |
| 938 | + '{{WRAPPER}} .king-addons-auto-scrolling-text' => 'margin-right: {{VALUE}}px;', | |
| 939 | + ], | |
| 940 | + ] | |
| 941 | + ); | |
| 942 | + | |
| 943 | + $this->add_responsive_control( | |
| 944 | + 'kng_auto_scroll_txt_animation_speed', | |
| 945 | + [ | |
| 946 | + 'label' => esc_html__('Animation Speed (s)', 'king-addons'), | |
| 947 | + 'type' => Controls_Manager::NUMBER, | |
| 948 | + 'min' => 0, | |
| 949 | + 'step' => 1, | |
| 950 | + 'default' => 80, | |
| 951 | + 'selectors' => [ | |
| 952 | + '{{WRAPPER}} .king-addons-auto-scrolling-text-wrapper' => 'animation-duration: {{VALUE}}s;', | |
| 953 | + ], | |
| 954 | + ] | |
| 955 | + ); | |
| 956 | + | |
| 957 | + $this->end_controls_section(); | |
| 958 | + /** END SECTION: Carousel Settings */ | |
| 959 | + | |
| 960 | + /** END TAB: CONTENT ===================== */ | |
| 961 | + | |
| 962 | + /** START TAB: STYLE ===================== */ | |
| 963 | + /** SECTION: Common Styles ===================== */ | |
| 964 | + $this->start_controls_section( | |
| 965 | + 'kng_auto_scroll_txt_style_section_commmon_styles', | |
| 966 | + [ | |
| 967 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Common Styles', 'king-addons'), | |
| 968 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 969 | + ] | |
| 970 | + ); | |
| 971 | + | |
| 972 | + $this->add_group_control( | |
| 973 | + Group_Control_Typography::get_type(), | |
| 974 | + [ | |
| 975 | + 'label' => esc_html__('Typography', 'king-addons'), | |
| 976 | + 'name' => 'kng_auto_scroll_txt_common_typography', | |
| 977 | + 'selector' => '{{WRAPPER}} .king-addons-auto-scrolling-text', | |
| 978 | + 'fields_options' => [ | |
| 979 | + 'font_size' => [ | |
| 980 | + 'default' => [ | |
| 981 | + 'size' => 50, | |
| 982 | + 'unit' => 'px' | |
| 983 | + ], | |
| 984 | + ], | |
| 985 | + 'typography' => [ | |
| 986 | + 'default' => 'custom', | |
| 987 | + ] | |
| 988 | + ], | |
| 989 | + ] | |
| 990 | + ); | |
| 991 | + | |
| 992 | + $this->add_control( | |
| 993 | + 'kng_auto_scroll_txt_common_color', | |
| 994 | + [ | |
| 995 | + 'label' => esc_html__('Text Color', 'king-addons'), | |
| 996 | + 'type' => Controls_Manager::COLOR, | |
| 997 | + 'selectors' => [ | |
| 998 | + '{{WRAPPER}} .king-addons-auto-scrolling-text' => 'color: {{VALUE}};', | |
| 999 | + ], | |
| 1000 | + ] | |
| 1001 | + ); | |
| 1002 | + | |
| 1003 | + $this->add_responsive_control( | |
| 1004 | + 'kng_auto_scroll_txt_common_items_padding', | |
| 1005 | + [ | |
| 1006 | + 'label' => esc_html__('Items Padding', 'king-addons'), | |
| 1007 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1008 | + 'size_units' => ['px', 'em', '%'], | |
| 1009 | + 'default' => [ | |
| 1010 | + 'top' => 0, | |
| 1011 | + 'right' => 0, | |
| 1012 | + 'bottom' => 0, | |
| 1013 | + 'left' => 0, | |
| 1014 | + 'unit' => 'px', | |
| 1015 | + ], | |
| 1016 | + 'selectors' => [ | |
| 1017 | + '{{WRAPPER}} .king-addons-auto-scrolling-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1018 | + ], | |
| 1019 | + 'separator' => 'before', | |
| 1020 | + ] | |
| 1021 | + ); | |
| 1022 | + | |
| 1023 | + $this->end_controls_section(); | |
| 1024 | + /** END SECTION: Common Styles ===================== */ | |
| 1025 | + /** END TAB: STYLE ===================== */ | |
| 1026 | + } | |
| 1027 | + | |
| 1028 | + protected function render(): void | |
| 1029 | + { | |
| 1030 | + $settings = Core::displaySettings($this); | |
| 1031 | + $this_ID = $this->get_id(); | |
| 1032 | + ?> | |
| 1033 | + <div class="king-addons-auto-scrolling-text-items-wrapper"> | |
| 1034 | + <div class="king-addons-auto-scrolling-text-items king-addons-auto-scrolling-text-items-<?php echo esc_attr($this_ID); ?>"> | |
| 1035 | + <div class="king-addons-auto-scrolling-text-wrapper king-addons-auto-scrolling-text-wrapper-<?php echo esc_attr($this_ID); ?>"> | |
| 1036 | + <div class="king-addons-auto-scrolling-text-group"> | |
| 1037 | + <?php | |
| 1038 | + | |
| 1039 | + $item_count = 0; | |
| 1040 | + | |
| 1041 | + /** @noinspection PhpUnusedLocalVariableInspection */ | |
| 1042 | + foreach ($settings['kng_auto_scroll_txt_content_items'] as $key => $item) { | |
| 1043 | + | |
| 1044 | + $content_type = $item['kng_auto_scroll_txt_content_type']; | |
| 1045 | + $item_tag = 'span'; | |
| 1046 | + | |
| 1047 | + $this->add_render_attribute('kng_auto_scroll_txt_content_inner_attribute' . $item_count, 'class', 'king-addons-auto-scrolling-text-inner'); | |
| 1048 | + | |
| 1049 | + // If the item has link | |
| 1050 | + if ('yes' === $item['kng_auto_scroll_txt_link_switcher']) { | |
| 1051 | + if ('' !== $item['kng_auto_scroll_txt_link']['url']) { | |
| 1052 | + | |
| 1053 | + $item_tag = 'a'; | |
| 1054 | + | |
| 1055 | + $this->add_render_attribute('kng_auto_scroll_txt_content_inner_attribute' . $item_count, 'href', esc_url($item['kng_auto_scroll_txt_link']['url'])); | |
| 1056 | + | |
| 1057 | + if ($item['kng_auto_scroll_txt_link']['is_external']) { | |
| 1058 | + $this->add_render_attribute('kng_auto_scroll_txt_content_inner_attribute' . $item_count, 'target', '_blank'); | |
| 1059 | + } | |
| 1060 | + | |
| 1061 | + if ($item['kng_auto_scroll_txt_link']['nofollow']) { | |
| 1062 | + $this->add_render_attribute('kng_auto_scroll_txt_content_inner_attribute' . $item_count, 'rel', 'nofollow'); | |
| 1063 | + } | |
| 1064 | + | |
| 1065 | + } | |
| 1066 | + } | |
| 1067 | + | |
| 1068 | + // If the item has custom CSS class | |
| 1069 | + if ('yes' === $item['kng_auto_scroll_txt_custom_css_class_switcher']) { | |
| 1070 | + if ('' !== $item['kng_auto_scroll_txt_custom_css_class']) { | |
| 1071 | + $this->add_render_attribute('kng_auto_scroll_txt_content_inner_attribute' . $item_count, 'class', esc_attr($item['kng_auto_scroll_txt_custom_css_class'])); | |
| 1072 | + } | |
| 1073 | + } | |
| 1074 | + | |
| 1075 | + /** START: Text Item ===================== */ | |
| 1076 | + if ('text' === $content_type) { | |
| 1077 | + | |
| 1078 | + $txt_effect = $item['kng_auto_scroll_txt_effect']; | |
| 1079 | + $txt_effect_class = ''; | |
| 1080 | + | |
| 1081 | + switch ($txt_effect) { | |
| 1082 | + case 'text-gradient': | |
| 1083 | + $txt_effect_class = ' king-addons-auto-scrolling-text-gradient'; | |
| 1084 | + break; | |
| 1085 | + case 'underline-gradient': | |
| 1086 | + $txt_effect_class = ' king-addons-auto-scrolling-text-underline-gradient'; | |
| 1087 | + break; | |
| 1088 | + } | |
| 1089 | + | |
| 1090 | + if ('' !== $item['kng_auto_scroll_txt_content']) { | |
| 1091 | + | |
| 1092 | + echo '<span class="elementor-repeater-item-' . | |
| 1093 | + esc_attr($item['_id']) . | |
| 1094 | + esc_attr($txt_effect_class) . ' king-addons-auto-scrolling-text">'; | |
| 1095 | + | |
| 1096 | + $html = '<' . esc_attr($item_tag) . ' ' . $this->get_render_attribute_string('kng_auto_scroll_txt_content_inner_attribute' . $item_count) . '>'; | |
| 1097 | + echo wp_kses($html, wp_kses_allowed_html('post')); | |
| 1098 | + | |
| 1099 | + echo '<span>' . wp_kses_post($item['kng_auto_scroll_txt_content']) . '</span>'; | |
| 1100 | + echo '</' . esc_attr($item_tag) . '></span>'; | |
| 1101 | + | |
| 1102 | + } | |
| 1103 | + | |
| 1104 | + } | |
| 1105 | + /** END: Text Item ===================== */ | |
| 1106 | + | |
| 1107 | + /** START: Image Item ===================== */ | |
| 1108 | + if ('image' === $content_type) { | |
| 1109 | + | |
| 1110 | + if ('' !== $item['kng_auto_scroll_txt_image']) { | |
| 1111 | + | |
| 1112 | + echo '<span class="elementor-repeater-item-' . | |
| 1113 | + esc_attr($item['_id']) . ' king-addons-auto-scrolling-text">'; | |
| 1114 | + | |
| 1115 | + $html = '<' . esc_attr($item_tag) . ' ' . $this->get_render_attribute_string('kng_auto_scroll_txt_content_inner_attribute' . $item_count) . '>'; | |
| 1116 | + echo wp_kses($html, wp_kses_allowed_html('post')); | |
| 1117 | + | |
| 1118 | + $image_html = Group_Control_Image_Size::get_attachment_image_html($item, 'kng_auto_scroll_txt_image_size', 'kng_auto_scroll_txt_image'); | |
| 1119 | + | |
| 1120 | + // Define allowed tags and attributes | |
| 1121 | + $allowed_tags = wp_kses_allowed_html('post'); | |
| 1122 | + $allowed_tags['img']['srcset'] = true; // Allow srcset attribute for img tag | |
| 1123 | + $allowed_tags['img']['sizes'] = true; // Allow sizes attribute for img tag | |
| 1124 | + $allowed_tags['img']['decoding'] = true; // Allow decoding attribute for img tag | |
| 1125 | + $allowed_tags['img']['loading'] = true; // Allow loading attribute for img tag. It is for the lazy loading possibility. | |
| 1126 | + | |
| 1127 | + // Sanitize the image HTML using the extended set of allowed tags and attributes | |
| 1128 | + echo wp_kses($image_html, $allowed_tags); | |
| 1129 | + | |
| 1130 | + echo '</' . esc_attr($item_tag) . '></span>'; | |
| 1131 | + | |
| 1132 | + } | |
| 1133 | + | |
| 1134 | + } | |
| 1135 | + /** END: Image Item ===================== */ | |
| 1136 | + | |
| 1137 | + $item_count++; | |
| 1138 | + } ?> | |
| 1139 | + </div> | |
| 1140 | + </div> | |
| 1141 | + </div> | |
| 1142 | + </div> | |
| 1143 | + <?php | |
| 1144 | + } | |
| 1145 | +} | |