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