Adv_Accordion.php
2 months ago
Adv_Tabs.php
2 months ago
Advanced_Data_Table.php
2 weeks ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
3 months ago
Betterdocs_Category_Grid.php
3 months ago
Betterdocs_Search_Form.php
2 months ago
Breadcrumbs.php
2 months ago
Business_Reviews.php
6 days ago
Caldera_Forms.php
2 months ago
Career_Page.php
4 years ago
Code_Snippet.php
4 months ago
Contact_Form_7.php
2 months ago
Content_Ticker.php
4 months ago
Countdown.php
2 months ago
Creative_Button.php
1 month ago
Cta_Box.php
2 months ago
Data_Table.php
2 months ago
Dual_Color_Header.php
6 days ago
EmbedPress.php
4 years ago
Event_Calendar.php
1 week ago
Facebook_Feed.php
4 months ago
Fancy_Text.php
2 months ago
Feature_List.php
4 months ago
Filterable_Gallery.php
6 days ago
Flip_Box.php
2 months ago
FluentForm.php
2 months ago
Formstack.php
2 months ago
GravityForms.php
6 days ago
Image_Accordion.php
2 months ago
Info_Box.php
6 days ago
Interactive_Circle.php
2 months ago
Login_Register.php
6 days ago
NFT_Gallery.php
4 months ago
NinjaForms.php
2 months ago
Post_Grid.php
4 months ago
Post_Timeline.php
10 months ago
Pricing_Table.php
2 months ago
Product_Grid.php
3 weeks ago
Progress_Bar.php
2 months ago
SVG_Draw.php
4 months ago
Simple_Menu.php
6 days ago
Sticky_Video.php
4 months ago
Team_Member.php
4 months ago
Testimonial.php
2 months ago
Tooltip.php
2 months ago
Twitter_Feed.php
4 months ago
TypeForm.php
5 months ago
WeForms.php
1 year ago
Woo_Add_To_Cart.php
2 months ago
Woo_Cart.php
4 months ago
Woo_Checkout.php
4 months ago
Woo_Product_Carousel.php
1 month ago
Woo_Product_Compare.php
1 year ago
Woo_Product_Gallery.php
4 months ago
Woo_Product_Images.php
1 month ago
Woo_Product_List.php
2 months ago
Woo_Product_Price.php
2 months ago
Woo_Product_Rating.php
2 months ago
WpForms.php
2 months ago
index.php
3 years ago
Content_Ticker.php
859 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Elements; |
| 4 | |
| 5 | // If this file is called directly, abort. |
| 6 | if (!defined('ABSPATH')) { |
| 7 | exit; |
| 8 | } |
| 9 | |
| 10 | use \Elementor\Controls_Manager; |
| 11 | use \Elementor\Group_Control_Border; |
| 12 | use \Elementor\Group_Control_Typography; |
| 13 | use \Elementor\Widget_Base; |
| 14 | use \Essential_Addons_Elementor\Classes\Helper; |
| 15 | |
| 16 | class Content_Ticker extends Widget_Base |
| 17 | { |
| 18 | |
| 19 | use \Essential_Addons_Elementor\Traits\Template_Query; |
| 20 | use \Essential_Addons_Elementor\Traits\Helper; |
| 21 | |
| 22 | public function get_name() |
| 23 | { |
| 24 | return 'eael-content-ticker'; |
| 25 | } |
| 26 | |
| 27 | public function get_title() |
| 28 | { |
| 29 | return esc_html__('Content Ticker', 'essential-addons-for-elementor-lite'); |
| 30 | } |
| 31 | |
| 32 | public function get_icon() |
| 33 | { |
| 34 | return 'eaicon-content-ticker'; |
| 35 | } |
| 36 | |
| 37 | public function get_style_depends(): array { |
| 38 | return [ 'e-swiper' ]; |
| 39 | } |
| 40 | |
| 41 | public function get_categories() |
| 42 | { |
| 43 | return ['essential-addons-elementor']; |
| 44 | } |
| 45 | |
| 46 | public function get_keywords() |
| 47 | { |
| 48 | return [ |
| 49 | 'ticker', |
| 50 | 'ea ticker', |
| 51 | 'ea content ticker', |
| 52 | 'news headline', |
| 53 | 'news ticker', |
| 54 | 'text rotate', |
| 55 | 'text animation', |
| 56 | 'text swing', |
| 57 | 'text slide', |
| 58 | 'ea', |
| 59 | 'essential addons', |
| 60 | ]; |
| 61 | } |
| 62 | |
| 63 | public function has_widget_inner_wrapper(): bool { |
| 64 | return ! Helper::eael_e_optimized_markup(); |
| 65 | } |
| 66 | |
| 67 | public function get_custom_help_url() |
| 68 | { |
| 69 | return 'https://essential-addons.com/elementor/docs/content-ticker/'; |
| 70 | } |
| 71 | |
| 72 | protected function register_controls() |
| 73 | { |
| 74 | /** |
| 75 | * Content Ticker Content Settings |
| 76 | */ |
| 77 | $this->start_controls_section( |
| 78 | 'eael_section_content_ticker_settings', |
| 79 | [ |
| 80 | 'label' => esc_html__('Ticker Settings', 'essential-addons-for-elementor-lite'), |
| 81 | ] |
| 82 | ); |
| 83 | |
| 84 | $this->add_control( |
| 85 | 'eael_dynamic_template_Layout', |
| 86 | [ |
| 87 | 'label' => esc_html__('Template Layout', 'essential-addons-for-elementor-lite'), |
| 88 | 'type' => Controls_Manager::SELECT, |
| 89 | 'default' => 'default', |
| 90 | 'options' => $this->get_template_list_for_dropdown(), |
| 91 | ] |
| 92 | ); |
| 93 | |
| 94 | $ticker_options = apply_filters( |
| 95 | 'eael_ticker_options', |
| 96 | [ |
| 97 | 'options' => [ |
| 98 | 'dynamic' => esc_html__('Dynamic', 'essential-addons-for-elementor-lite'), |
| 99 | 'custom' => esc_html__('Custom', 'essential-addons-for-elementor-lite'), |
| 100 | ], |
| 101 | 'conditions' => [ |
| 102 | 'custom', |
| 103 | ], |
| 104 | ] |
| 105 | ); |
| 106 | |
| 107 | $this->add_control( |
| 108 | 'eael_ticker_type', |
| 109 | [ |
| 110 | 'label' => esc_html__('Ticker Type', 'essential-addons-for-elementor-lite'), |
| 111 | 'type' => Controls_Manager::SELECT, |
| 112 | 'default' => 'dynamic', |
| 113 | 'label_block' => false, |
| 114 | 'options' => $ticker_options['options'], |
| 115 | ] |
| 116 | ); |
| 117 | |
| 118 | $this->add_control( |
| 119 | 'eael_ticker_type_pro_alert', |
| 120 | [ |
| 121 | 'label' => esc_html__('Custom Content available in pro version only!', 'essential-addons-for-elementor-lite'), |
| 122 | 'type' => Controls_Manager::HEADING, |
| 123 | 'condition' => [ |
| 124 | 'eael_ticker_type' => $ticker_options['conditions'], |
| 125 | ], |
| 126 | ] |
| 127 | ); |
| 128 | |
| 129 | $this->add_control( |
| 130 | 'eael_ticker_tag_text', |
| 131 | [ |
| 132 | 'label' => esc_html__('Tag Text', 'essential-addons-for-elementor-lite'), |
| 133 | 'type' => Controls_Manager::TEXT, |
| 134 | 'dynamic' => [ |
| 135 | 'active' => true, |
| 136 | ], |
| 137 | 'label_block' => false, |
| 138 | 'default' => esc_html__('Trending Today', 'essential-addons-for-elementor-lite'), |
| 139 | 'ai' => [ |
| 140 | 'active' => true, |
| 141 | ], |
| 142 | ] |
| 143 | ); |
| 144 | |
| 145 | $this->end_controls_section(); |
| 146 | |
| 147 | /** |
| 148 | * Query Controls |
| 149 | * @source includes/helper.php |
| 150 | */ |
| 151 | do_action('eael/controls/query', $this); |
| 152 | |
| 153 | do_action('eael_ticker_custom_content_controls', $this); |
| 154 | |
| 155 | /** |
| 156 | * Content Tab: Carousel Settings |
| 157 | */ |
| 158 | $this->start_controls_section( |
| 159 | 'section_additional_options', |
| 160 | [ |
| 161 | 'label' => __('Animation Settings', 'essential-addons-for-elementor-lite'), |
| 162 | ] |
| 163 | ); |
| 164 | |
| 165 | $this->add_control( |
| 166 | 'carousel_effect', |
| 167 | [ |
| 168 | 'label' => __('Effect', 'essential-addons-for-elementor-lite'), |
| 169 | 'description' => __('Sets transition effect', 'essential-addons-for-elementor-lite'), |
| 170 | 'type' => Controls_Manager::SELECT, |
| 171 | 'default' => 'slide', |
| 172 | 'options' => [ |
| 173 | 'slide' => __('Slide', 'essential-addons-for-elementor-lite'), |
| 174 | 'fade' => __('Fade', 'essential-addons-for-elementor-lite'), |
| 175 | ], |
| 176 | ] |
| 177 | ); |
| 178 | |
| 179 | $this->add_control( |
| 180 | 'slider_speed', |
| 181 | [ |
| 182 | 'label' => __('Slider Speed', 'essential-addons-for-elementor-lite'), |
| 183 | 'description' => __('Duration of transition between slides (in ms)', 'essential-addons-for-elementor-lite'), |
| 184 | 'type' => Controls_Manager::SLIDER, |
| 185 | 'default' => ['size' => 400], |
| 186 | 'range' => [ |
| 187 | 'px' => [ |
| 188 | 'min' => 100, |
| 189 | 'max' => 3000, |
| 190 | 'step' => 1, |
| 191 | ], |
| 192 | ], |
| 193 | 'size_units' => '', |
| 194 | 'separator' => 'before', |
| 195 | ] |
| 196 | ); |
| 197 | |
| 198 | $this->add_control( |
| 199 | 'autoplay', |
| 200 | [ |
| 201 | 'label' => __('Autoplay', 'essential-addons-for-elementor-lite'), |
| 202 | 'type' => Controls_Manager::SWITCHER, |
| 203 | 'default' => 'yes', |
| 204 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 205 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 206 | 'return_value' => 'yes', |
| 207 | 'separator' => 'before', |
| 208 | ] |
| 209 | ); |
| 210 | |
| 211 | $this->add_control( |
| 212 | 'autoplay_speed', |
| 213 | [ |
| 214 | 'label' => __('Autoplay Speed', 'essential-addons-for-elementor-lite'), |
| 215 | 'type' => Controls_Manager::SLIDER, |
| 216 | 'default' => ['size' => 2000], |
| 217 | 'range' => [ |
| 218 | 'px' => [ |
| 219 | 'min' => 500, |
| 220 | 'max' => 5000, |
| 221 | 'step' => 1, |
| 222 | ], |
| 223 | ], |
| 224 | 'size_units' => '', |
| 225 | 'condition' => [ |
| 226 | 'autoplay' => 'yes', |
| 227 | ], |
| 228 | ] |
| 229 | ); |
| 230 | |
| 231 | $this->add_control( |
| 232 | 'pause_on_hover', |
| 233 | [ |
| 234 | 'label' => __('Pause On Hover', 'essential-addons-for-elementor-lite'), |
| 235 | 'type' => Controls_Manager::SWITCHER, |
| 236 | 'default' => '', |
| 237 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 238 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 239 | 'return_value' => 'yes', |
| 240 | 'condition' => [ |
| 241 | 'autoplay' => 'yes', |
| 242 | ], |
| 243 | ] |
| 244 | ); |
| 245 | |
| 246 | $this->add_control( |
| 247 | 'infinite_loop', |
| 248 | [ |
| 249 | 'label' => __('Infinite Loop', 'essential-addons-for-elementor-lite'), |
| 250 | 'type' => Controls_Manager::SWITCHER, |
| 251 | 'default' => 'yes', |
| 252 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 253 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 254 | 'return_value' => 'yes', |
| 255 | ] |
| 256 | ); |
| 257 | |
| 258 | $this->add_control( |
| 259 | 'grab_cursor', |
| 260 | [ |
| 261 | 'label' => __('Grab Cursor', 'essential-addons-for-elementor-lite'), |
| 262 | 'description' => __('Shows grab cursor when you hover over the slider', 'essential-addons-for-elementor-lite'), |
| 263 | 'type' => Controls_Manager::SWITCHER, |
| 264 | 'default' => '', |
| 265 | 'label_on' => __('Show', 'essential-addons-for-elementor-lite'), |
| 266 | 'label_off' => __('Hide', 'essential-addons-for-elementor-lite'), |
| 267 | 'return_value' => 'yes', |
| 268 | 'separator' => 'before', |
| 269 | ] |
| 270 | ); |
| 271 | |
| 272 | $this->add_control( |
| 273 | 'navigation_heading', |
| 274 | [ |
| 275 | 'label' => __('Navigation', 'essential-addons-for-elementor-lite'), |
| 276 | 'type' => Controls_Manager::HEADING, |
| 277 | 'separator' => 'before', |
| 278 | ] |
| 279 | ); |
| 280 | |
| 281 | $this->add_control( |
| 282 | 'arrows', |
| 283 | [ |
| 284 | 'label' => __('Arrows', 'essential-addons-for-elementor-lite'), |
| 285 | 'type' => Controls_Manager::SWITCHER, |
| 286 | 'default' => 'yes', |
| 287 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 288 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 289 | 'return_value' => 'yes', |
| 290 | ] |
| 291 | ); |
| 292 | |
| 293 | $this->add_control( |
| 294 | 'direction', |
| 295 | [ |
| 296 | 'label' => __('Direction', 'essential-addons-for-elementor-lite'), |
| 297 | 'type' => Controls_Manager::SELECT, |
| 298 | 'default' => 'left', |
| 299 | 'options' => [ |
| 300 | 'left' => __('Left', 'essential-addons-for-elementor-lite'), |
| 301 | 'right' => __('Right', 'essential-addons-for-elementor-lite'), |
| 302 | ], |
| 303 | 'separator' => 'before', |
| 304 | 'condition' => [ |
| 305 | 'carousel_effect' => 'slide', |
| 306 | ], |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | $this->end_controls_section(); |
| 311 | |
| 312 | if (!apply_filters('eael/pro_enabled', false)) { |
| 313 | $this->start_controls_section( |
| 314 | 'eael_section_pro', |
| 315 | [ |
| 316 | 'label' => __('Go Premium for More Features', 'essential-addons-for-elementor-lite'), |
| 317 | ] |
| 318 | ); |
| 319 | |
| 320 | $this->add_control( |
| 321 | 'eael_control_get_pro', |
| 322 | [ |
| 323 | 'label' => __('Unlock more possibilities', 'essential-addons-for-elementor-lite'), |
| 324 | 'type' => Controls_Manager::CHOOSE, |
| 325 | 'options' => [ |
| 326 | '1' => [ |
| 327 | 'title' => '', |
| 328 | 'icon' => 'fa fa-unlock-alt', |
| 329 | ], |
| 330 | ], |
| 331 | 'default' => '1', |
| 332 | 'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>', |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | $this->end_controls_section(); |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * ------------------------------------------- |
| 341 | * Tab Style (Ticker Content Style) |
| 342 | * ------------------------------------------- |
| 343 | */ |
| 344 | $this->start_controls_section( |
| 345 | 'eael_section_ticker_typography_settings', |
| 346 | [ |
| 347 | 'label' => esc_html__('Ticker Content', 'essential-addons-for-elementor-lite'), |
| 348 | 'tab' => Controls_Manager::TAB_STYLE, |
| 349 | ] |
| 350 | ); |
| 351 | |
| 352 | $this->add_control( |
| 353 | 'eael_ticker_content_bg', |
| 354 | [ |
| 355 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 356 | 'type' => Controls_Manager::COLOR, |
| 357 | 'default' => '', |
| 358 | 'selectors' => [ |
| 359 | '{{WRAPPER}} .eael-ticker-wrap .eael-ticker' => 'background-color: {{VALUE}};', |
| 360 | ], |
| 361 | ] |
| 362 | ); |
| 363 | |
| 364 | $this->add_control( |
| 365 | 'eael_ticker_content_color', |
| 366 | [ |
| 367 | 'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'), |
| 368 | 'type' => Controls_Manager::COLOR, |
| 369 | 'default' => '#222222', |
| 370 | 'selectors' => [ |
| 371 | '{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content a' => 'color: {{VALUE}};', |
| 372 | ], |
| 373 | ] |
| 374 | ); |
| 375 | $this->add_control( |
| 376 | 'eael_ticker_hover_content_color', |
| 377 | [ |
| 378 | 'label' => esc_html__('Text Hover Color', 'essential-addons-for-elementor-lite'), |
| 379 | 'type' => Controls_Manager::COLOR, |
| 380 | 'default' => '#f44336', |
| 381 | 'selectors' => [ |
| 382 | '{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content a:hover' => 'color: {{VALUE}};', |
| 383 | ], |
| 384 | ] |
| 385 | ); |
| 386 | |
| 387 | $this->add_group_control( |
| 388 | Group_Control_Typography::get_type(), |
| 389 | [ |
| 390 | 'name' => 'eael_ticker_content_typography', |
| 391 | 'selector' => '{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content a', |
| 392 | |
| 393 | ] |
| 394 | ); |
| 395 | |
| 396 | $this->add_responsive_control( |
| 397 | 'eael_ticker_content_padding', |
| 398 | [ |
| 399 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 400 | 'type' => Controls_Manager::DIMENSIONS, |
| 401 | 'size_units' => ['px', 'em', '%'], |
| 402 | 'selectors' => [ |
| 403 | '{{WRAPPER}} .eael-ticker-wrap .eael-ticker .ticker-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 404 | ], |
| 405 | ] |
| 406 | ); |
| 407 | |
| 408 | $this->add_control( |
| 409 | 'eael_ticker_content_radius', |
| 410 | [ |
| 411 | 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'), |
| 412 | 'type' => Controls_Manager::DIMENSIONS, |
| 413 | 'size_units' => ['px', 'em', '%'], |
| 414 | 'selectors' => [ |
| 415 | '{{WRAPPER}} .eael-ticker-wrap .eael-ticker' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 416 | ], |
| 417 | ] |
| 418 | ); |
| 419 | |
| 420 | $this->end_controls_section(); |
| 421 | |
| 422 | $this->start_controls_section( |
| 423 | 'eael_section_ticker_tag_style_settings', |
| 424 | [ |
| 425 | 'label' => esc_html__('Tag Style', 'essential-addons-for-elementor-lite'), |
| 426 | 'tab' => Controls_Manager::TAB_STYLE, |
| 427 | ] |
| 428 | ); |
| 429 | $this->add_control( |
| 430 | 'eael_ticker_tag_bg_color', |
| 431 | [ |
| 432 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 433 | 'type' => Controls_Manager::COLOR, |
| 434 | 'default' => '#222222', |
| 435 | 'selectors' => [ |
| 436 | '{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'background-color: {{VALUE}};', |
| 437 | ], |
| 438 | ] |
| 439 | ); |
| 440 | $this->add_control( |
| 441 | 'eael_ticker_tag_color', |
| 442 | [ |
| 443 | 'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'), |
| 444 | 'type' => Controls_Manager::COLOR, |
| 445 | 'default' => '#fff', |
| 446 | 'selectors' => [ |
| 447 | '{{WRAPPER}} .eael-ticker-wrap .ticker-badge span' => 'color: {{VALUE}};', |
| 448 | ], |
| 449 | ] |
| 450 | ); |
| 451 | |
| 452 | $this->add_group_control( |
| 453 | Group_Control_Typography::get_type(), |
| 454 | [ |
| 455 | 'name' => 'eael_ticker_tag_typography', |
| 456 | 'selector' => '{{WRAPPER}} .eael-ticker-wrap .ticker-badge span', |
| 457 | ] |
| 458 | ); |
| 459 | $this->add_responsive_control( |
| 460 | 'eael_ticker_tag_padding', |
| 461 | [ |
| 462 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 463 | 'type' => Controls_Manager::DIMENSIONS, |
| 464 | 'size_units' => ['px', 'em', '%'], |
| 465 | 'selectors' => [ |
| 466 | '{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 467 | ], |
| 468 | ] |
| 469 | ); |
| 470 | |
| 471 | $this->add_responsive_control( |
| 472 | 'eael_ticker_tag_margin', |
| 473 | [ |
| 474 | 'label' => esc_html__('Margin', 'essential-addons-for-elementor-lite'), |
| 475 | 'type' => Controls_Manager::DIMENSIONS, |
| 476 | 'size_units' => ['px', 'em', '%'], |
| 477 | 'selectors' => [ |
| 478 | '{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 479 | ], |
| 480 | ] |
| 481 | ); |
| 482 | $this->add_responsive_control( |
| 483 | 'eael_ticker_tag_radius', |
| 484 | [ |
| 485 | 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'), |
| 486 | 'type' => Controls_Manager::DIMENSIONS, |
| 487 | 'size_units' => ['px', 'em', '%'], |
| 488 | 'selectors' => [ |
| 489 | '{{WRAPPER}} .eael-ticker-wrap .ticker-badge' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 490 | ], |
| 491 | ] |
| 492 | ); |
| 493 | $this->end_controls_section(); |
| 494 | |
| 495 | /** |
| 496 | * Style Tab: Arrows |
| 497 | */ |
| 498 | $this->start_controls_section( |
| 499 | 'section_arrows_style', |
| 500 | [ |
| 501 | 'label' => __('Arrows', 'essential-addons-for-elementor-lite'), |
| 502 | 'tab' => Controls_Manager::TAB_STYLE, |
| 503 | 'condition' => [ |
| 504 | 'arrows' => 'yes', |
| 505 | ], |
| 506 | ] |
| 507 | ); |
| 508 | |
| 509 | $this->add_control( |
| 510 | 'prev_arrow', |
| 511 | [ |
| 512 | 'label' => __('Choose Prev Arrow', 'essential-addons-for-elementor-lite'), |
| 513 | 'type' => Controls_Manager::ICONS, |
| 514 | 'label_block' => true, |
| 515 | 'default' => [ |
| 516 | 'value' => 'fas fa-angle-left', |
| 517 | 'library' => 'fa-solid', |
| 518 | ], |
| 519 | ] |
| 520 | ); |
| 521 | |
| 522 | $this->add_control( |
| 523 | 'arrow_new', |
| 524 | [ |
| 525 | 'label' => __('Choose Next Arrow', 'essential-addons-for-elementor-lite'), |
| 526 | 'type' => Controls_Manager::ICONS, |
| 527 | 'fa4compatibility' => 'arrow', |
| 528 | 'label_block' => true, |
| 529 | 'default' => [ |
| 530 | 'value' => 'fas fa-angle-right', |
| 531 | 'library' => 'fa-solid', |
| 532 | ], |
| 533 | ] |
| 534 | ); |
| 535 | |
| 536 | $this->add_responsive_control( |
| 537 | 'arrows_size', |
| 538 | [ |
| 539 | 'label' => __('Arrows Size', 'essential-addons-for-elementor-lite'), |
| 540 | 'type' => Controls_Manager::SLIDER, |
| 541 | 'default' => ['size' => '22'], |
| 542 | 'range' => [ |
| 543 | 'px' => [ |
| 544 | 'min' => 5, |
| 545 | 'max' => 100, |
| 546 | 'step' => 1, |
| 547 | ], |
| 548 | ], |
| 549 | 'size_units' => ['px'], |
| 550 | 'selectors' => [ |
| 551 | '{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'font-size: {{SIZE}}{{UNIT}};', |
| 552 | '{{WRAPPER}} .eael-ticker .swiper-button-next img, {{WRAPPER}} .eael-ticker .swiper-button-prev img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 553 | '{{WRAPPER}} .eael-ticker .swiper-button-next svg, {{WRAPPER}} .eael-ticker .swiper-button-prev svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};', |
| 554 | ], |
| 555 | ] |
| 556 | ); |
| 557 | |
| 558 | $this->add_responsive_control( |
| 559 | 'left_arrow_position', |
| 560 | [ |
| 561 | 'label' => __('Align Left Arrow', 'essential-addons-for-elementor-lite'), |
| 562 | 'type' => Controls_Manager::SLIDER, |
| 563 | 'range' => [ |
| 564 | 'px' => [ |
| 565 | 'min' => -100, |
| 566 | 'max' => 100, |
| 567 | 'step' => 1, |
| 568 | ], |
| 569 | ], |
| 570 | 'size_units' => ['px'], |
| 571 | 'selectors' => [ |
| 572 | '{{WRAPPER}} .eael-ticker .swiper-button-prev' => 'right: {{SIZE}}{{UNIT}};', |
| 573 | ], |
| 574 | ] |
| 575 | ); |
| 576 | |
| 577 | $this->add_responsive_control( |
| 578 | 'right_arrow_position', |
| 579 | [ |
| 580 | 'label' => __('Align Right Arrow', 'essential-addons-for-elementor-lite'), |
| 581 | 'type' => Controls_Manager::SLIDER, |
| 582 | 'range' => [ |
| 583 | 'px' => [ |
| 584 | 'min' => -100, |
| 585 | 'max' => 100, |
| 586 | 'step' => 1, |
| 587 | ], |
| 588 | ], |
| 589 | 'size_units' => ['px'], |
| 590 | 'default' => [ |
| 591 | 'unit' => 'px', |
| 592 | 'size' => 0, |
| 593 | ], |
| 594 | 'selectors' => [ |
| 595 | '{{WRAPPER}} .eael-ticker .swiper-button-next' => 'right: {{SIZE}}{{UNIT}};', |
| 596 | ], |
| 597 | ] |
| 598 | ); |
| 599 | |
| 600 | $this->start_controls_tabs('tabs_arrows_style'); |
| 601 | |
| 602 | $this->start_controls_tab( |
| 603 | 'tab_arrows_normal', |
| 604 | [ |
| 605 | 'label' => __('Normal', 'essential-addons-for-elementor-lite'), |
| 606 | ] |
| 607 | ); |
| 608 | |
| 609 | $this->add_control( |
| 610 | 'arrows_bg_color_normal', |
| 611 | [ |
| 612 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 613 | 'type' => Controls_Manager::COLOR, |
| 614 | 'default' => '', |
| 615 | 'selectors' => [ |
| 616 | '{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'background-color: {{VALUE}};', |
| 617 | ], |
| 618 | ] |
| 619 | ); |
| 620 | |
| 621 | $this->add_control( |
| 622 | 'arrows_color_normal', |
| 623 | [ |
| 624 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 625 | 'type' => Controls_Manager::COLOR, |
| 626 | 'default' => '', |
| 627 | 'selectors' => [ |
| 628 | '{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'color: {{VALUE}};', |
| 629 | '{{WRAPPER}} .eael-ticker .swiper-button-next svg, {{WRAPPER}} .eael-ticker .swiper-button-prev svg' => 'fill: {{VALUE}};', |
| 630 | ], |
| 631 | ] |
| 632 | ); |
| 633 | |
| 634 | $this->add_group_control( |
| 635 | Group_Control_Border::get_type(), |
| 636 | [ |
| 637 | 'name' => 'arrows_border_normal', |
| 638 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 639 | 'placeholder' => '1px', |
| 640 | 'default' => '1px', |
| 641 | 'selector' => '{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev', |
| 642 | ] |
| 643 | ); |
| 644 | |
| 645 | $this->add_control( |
| 646 | 'arrows_border_radius_normal', |
| 647 | [ |
| 648 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 649 | 'type' => Controls_Manager::DIMENSIONS, |
| 650 | 'size_units' => ['px', '%'], |
| 651 | 'selectors' => [ |
| 652 | '{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 653 | ], |
| 654 | ] |
| 655 | ); |
| 656 | |
| 657 | $this->end_controls_tab(); |
| 658 | |
| 659 | $this->start_controls_tab( |
| 660 | 'tab_arrows_hover', |
| 661 | [ |
| 662 | 'label' => __('Hover', 'essential-addons-for-elementor-lite'), |
| 663 | ] |
| 664 | ); |
| 665 | |
| 666 | $this->add_control( |
| 667 | 'arrows_bg_color_hover', |
| 668 | [ |
| 669 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 670 | 'type' => Controls_Manager::COLOR, |
| 671 | 'default' => '', |
| 672 | 'selectors' => [ |
| 673 | '{{WRAPPER}} .eael-ticker .swiper-button-next:hover, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover' => 'background-color: {{VALUE}};', |
| 674 | ], |
| 675 | ] |
| 676 | ); |
| 677 | |
| 678 | $this->add_control( |
| 679 | 'arrows_color_hover', |
| 680 | [ |
| 681 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 682 | 'type' => Controls_Manager::COLOR, |
| 683 | 'default' => '', |
| 684 | 'selectors' => [ |
| 685 | '{{WRAPPER}} .eael-ticker .swiper-button-next:hover, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover' => 'color: {{VALUE}};', |
| 686 | '{{WRAPPER}} .eael-ticker .swiper-button-next:hover svg, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover svg' => 'fill: {{VALUE}};', |
| 687 | ], |
| 688 | ] |
| 689 | ); |
| 690 | |
| 691 | $this->add_control( |
| 692 | 'arrows_border_color_hover', |
| 693 | [ |
| 694 | 'label' => __('Border Color', 'essential-addons-for-elementor-lite'), |
| 695 | 'type' => Controls_Manager::COLOR, |
| 696 | 'default' => '', |
| 697 | 'selectors' => [ |
| 698 | '{{WRAPPER}} .eael-ticker .swiper-button-next:hover, {{WRAPPER}} .eael-ticker .swiper-button-prev:hover' => 'border-color: {{VALUE}};', |
| 699 | ], |
| 700 | ] |
| 701 | ); |
| 702 | |
| 703 | $this->end_controls_tab(); |
| 704 | |
| 705 | $this->end_controls_tabs(); |
| 706 | |
| 707 | $this->add_responsive_control( |
| 708 | 'arrows_padding', |
| 709 | [ |
| 710 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 711 | 'type' => Controls_Manager::DIMENSIONS, |
| 712 | 'size_units' => ['px', '%'], |
| 713 | 'selectors' => [ |
| 714 | '{{WRAPPER}} .eael-ticker .swiper-button-next, {{WRAPPER}} .eael-ticker .swiper-button-prev' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 715 | ], |
| 716 | 'separator' => 'before', |
| 717 | ] |
| 718 | ); |
| 719 | |
| 720 | $this->end_controls_section(); |
| 721 | } |
| 722 | |
| 723 | protected function render() |
| 724 | { |
| 725 | $settings = $this->get_settings_for_display(); |
| 726 | $settings = Helper::fix_old_query($settings); |
| 727 | $args = Helper::get_query_args($settings); |
| 728 | |
| 729 | $this->add_render_attribute('content-ticker-wrap', 'class', 'eael-ticker'); |
| 730 | $this->add_render_attribute('content-ticker', 'class', 'swiper' ); |
| 731 | $this->add_render_attribute('content-ticker', 'class', 'swiper-8' ); |
| 732 | $this->add_render_attribute('content-ticker', 'class', 'eael-content-ticker'); |
| 733 | $this->add_render_attribute('content-ticker', 'class', 'swiper-container-' . esc_attr($this->get_id())); |
| 734 | $this->add_render_attribute('content-ticker', 'data-pagination', '.swiper-pagination-' . esc_attr($this->get_id())); |
| 735 | $this->add_render_attribute('content-ticker', 'data-arrow-next', '.swiper-button-next-' . esc_attr($this->get_id())); |
| 736 | $this->add_render_attribute('content-ticker', 'data-arrow-prev', '.swiper-button-prev-' . esc_attr($this->get_id())); |
| 737 | |
| 738 | if ($settings['direction'] == 'right') { |
| 739 | $this->add_render_attribute('content-ticker', 'dir', 'rtl'); |
| 740 | } |
| 741 | |
| 742 | if (!empty($settings['margin_tablet']['size'])) { |
| 743 | $this->add_render_attribute('content-ticker', 'data-margin-tablet', $settings['margin_tablet']['size']); |
| 744 | } |
| 745 | if (!empty($settings['margin_mobile']['size'])) { |
| 746 | $this->add_render_attribute('content-ticker', 'data-margin-mobile', $settings['margin_mobile']['size']); |
| 747 | } |
| 748 | if ($settings['carousel_effect']) { |
| 749 | $this->add_render_attribute('content-ticker', 'data-effect', $settings['carousel_effect']); |
| 750 | } |
| 751 | if (!empty($settings['slider_speed']['size'])) { |
| 752 | $this->add_render_attribute('content-ticker', 'data-speed', $settings['slider_speed']['size']); |
| 753 | } |
| 754 | if ($settings['autoplay'] == 'yes' && !empty($settings['autoplay_speed']['size'])) { |
| 755 | $this->add_render_attribute('content-ticker', 'data-autoplay', $settings['autoplay_speed']['size']); |
| 756 | } else { |
| 757 | $this->add_render_attribute('content-ticker', 'data-autoplay', '999999'); |
| 758 | } |
| 759 | if ($settings['pause_on_hover'] == 'yes') { |
| 760 | $this->add_render_attribute('content-ticker', 'data-pause-on-hover', 'true'); |
| 761 | } |
| 762 | if ($settings['infinite_loop'] == 'yes') { |
| 763 | $this->add_render_attribute('content-ticker', 'data-loop', true); |
| 764 | } |
| 765 | if ($settings['grab_cursor'] == 'yes') { |
| 766 | $this->add_render_attribute('content-ticker', 'data-grab-cursor', true); |
| 767 | } |
| 768 | if ($settings['arrows'] == 'yes') { |
| 769 | $this->add_render_attribute('content-ticker', 'data-arrows', '1'); |
| 770 | } |
| 771 | |
| 772 | echo '<div class="eael-ticker-wrap" id="eael-ticker-wrap-' . esc_attr( $this->get_id() ) . '">'; |
| 773 | if (!empty($settings['eael_ticker_tag_text'])) { |
| 774 | echo '<div class="ticker-badge"> |
| 775 | <span>' . wp_kses( $settings['eael_ticker_tag_text'], Helper::eael_allowed_tags() ) . '</span> |
| 776 | </div>'; |
| 777 | } |
| 778 | |
| 779 | echo '<div '; $this->print_render_attribute_string('content-ticker-wrap'); echo '> |
| 780 | <div '; $this->print_render_attribute_string('content-ticker'); echo '> |
| 781 | <div class="swiper-wrapper">'; |
| 782 | |
| 783 | if ('dynamic' === $settings['eael_ticker_type']) { |
| 784 | |
| 785 | if (\file_exists($this->get_template($settings['eael_dynamic_template_Layout']))) { |
| 786 | if ( $args['post_type'] === 'tribe_events' ) { |
| 787 | $this->eael_forcefully_remove_action( 'pre_get_posts', 'attach_monitor', 200 ); |
| 788 | } |
| 789 | $query = new \WP_Query($args); |
| 790 | if ($query->have_posts()) { |
| 791 | while ($query->have_posts()) { |
| 792 | $query->the_post(); |
| 793 | include $this->get_template($settings['eael_dynamic_template_Layout']); |
| 794 | } |
| 795 | wp_reset_postdata(); |
| 796 | } |
| 797 | } else { |
| 798 | echo '<div class="swiper-slide"><a href="#" class="ticker-content">' . esc_html__('No content found!', 'essential-addons-for-elementor-lite') . '</a></div>'; |
| 799 | } |
| 800 | } elseif ('custom' === $settings['eael_ticker_type'] && apply_filters('eael/is_plugin_active', 'essential-addons-elementor/essential_adons_elementor.php')) { |
| 801 | if (\file_exists($this->get_template($settings['eael_dynamic_template_Layout']))) { |
| 802 | foreach ($settings['eael_ticker_custom_contents'] as $content) { |
| 803 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 804 | echo Helper::include_with_variable( $this->get_template( $settings['eael_dynamic_template_Layout']), ['content' => Helper::eael_wp_kses($content['eael_ticker_custom_content']), 'link' => $content['eael_ticker_custom_content_link']]); |
| 805 | } |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | echo '</div> |
| 810 | </div> '; |
| 811 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 812 | echo $this->render_arrows(); |
| 813 | echo '</div> |
| 814 | </div>'; |
| 815 | } |
| 816 | |
| 817 | /** |
| 818 | * Render Content Ticker arrows output on the frontend. |
| 819 | * |
| 820 | * Written in PHP and used to generate the final HTML. |
| 821 | * |
| 822 | * @access protected |
| 823 | */ |
| 824 | protected function render_arrows() |
| 825 | { |
| 826 | $settings = $this->get_settings_for_display(); |
| 827 | |
| 828 | if ($settings['arrows'] == 'yes') { |
| 829 | if (isset($settings['__fa4_migrated']['arrow_new']) || empty($settings['arrow'])) { |
| 830 | $arrow = Helper::get_render_icon( $settings['arrow_new'] ); |
| 831 | } else { |
| 832 | $arrow = '<i class="' . esc_attr( $settings['arrow'] ) . '"></i>'; |
| 833 | } |
| 834 | |
| 835 | $html = '<div class="content-ticker-pagination">'; |
| 836 | |
| 837 | $html .= '<div class="swiper-button-next swiper-button-next-' . esc_attr( $this->get_id() ) . '">'; |
| 838 | if (isset($arrow['url'])) { |
| 839 | $html .= '<img src="' . esc_url($arrow['url']) . '" alt="' . esc_attr(get_post_meta($arrow['id'], '_wp_attachment_image_alt', true)) . '" />'; |
| 840 | } else { |
| 841 | $html .= $arrow; |
| 842 | } |
| 843 | $html .= '</div>'; |
| 844 | |
| 845 | $html .= '<div class="swiper-button-prev swiper-button-prev-' . esc_attr( $this->get_id() ) . '">'; |
| 846 | if (isset($settings['prev_arrow']['value']['url'])) { |
| 847 | $html .= '<img src="' . esc_url($settings['prev_arrow']['value']['url']) . '" alt="' . esc_attr(get_post_meta($settings['prev_arrow']['value']['id'], '_wp_attachment_image_alt', true)) . '" />'; |
| 848 | } else { |
| 849 | $html .= Helper::get_render_icon( $settings['prev_arrow'] ); |
| 850 | } |
| 851 | $html .= '</div>'; |
| 852 | |
| 853 | $html .= '</div>'; |
| 854 | |
| 855 | return $html; |
| 856 | } |
| 857 | } |
| 858 | } |
| 859 |