dep
5 years ago
premium-banner.php
5 years ago
premium-blog.php
5 years ago
premium-button.php
5 years ago
premium-carousel.php
5 years ago
premium-contactform.php
5 years ago
premium-countdown.php
5 years ago
premium-counter.php
5 years ago
premium-dual-header.php
5 years ago
premium-fancytext.php
5 years ago
premium-grid.php
5 years ago
premium-icon-list.php
5 years ago
premium-image-button.php
5 years ago
premium-image-scroll.php
5 years ago
premium-image-separator.php
5 years ago
premium-lottie.php
5 years ago
premium-maps.php
5 years ago
premium-modalbox.php
5 years ago
premium-person.php
5 years ago
premium-pricing-table.php
5 years ago
premium-progressbar.php
5 years ago
premium-testimonials.php
5 years ago
premium-title.php
5 years ago
premium-videobox.php
5 years ago
premium-vscroll.php
5 years ago
premium-banner.php
1245 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Premium Banner. |
| 5 | */ |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Widget_Base; |
| 10 | use Elementor\Utils; |
| 11 | use Elementor\Control_Media; |
| 12 | use Elementor\Controls_Manager; |
| 13 | use Elementor\Scheme_Color; |
| 14 | use Elementor\Scheme_Typography; |
| 15 | use Elementor\Group_Control_Border; |
| 16 | use Elementor\Group_Control_Image_Size; |
| 17 | use Elementor\Group_Control_Typography; |
| 18 | use Elementor\Group_Control_Css_Filter; |
| 19 | use Elementor\Group_Control_Box_Shadow; |
| 20 | use Elementor\Group_Control_Text_Shadow; |
| 21 | |
| 22 | // PremiumAddons Classes. |
| 23 | use PremiumAddons\Includes\Helper_Functions; |
| 24 | use PremiumAddons\Includes\Premium_Template_Tags; |
| 25 | |
| 26 | if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort. |
| 27 | |
| 28 | /** |
| 29 | * Class Premium_Banner |
| 30 | */ |
| 31 | class Premium_Banner extends Widget_Base { |
| 32 | |
| 33 | protected $templateInstance; |
| 34 | |
| 35 | public function getTemplateInstance() { |
| 36 | return $this->templateInstance = Premium_Template_Tags::getInstance(); |
| 37 | } |
| 38 | |
| 39 | public function get_name() { |
| 40 | return 'premium-addon-banner'; |
| 41 | } |
| 42 | |
| 43 | public function get_title() { |
| 44 | return sprintf( '%1$s %2$s', Helper_Functions::get_prefix(), __('Banner', 'premium-addons-for-elementor') ); |
| 45 | } |
| 46 | |
| 47 | public function get_icon() { |
| 48 | return 'pa-banner'; |
| 49 | } |
| 50 | |
| 51 | public function get_categories() { |
| 52 | return [ 'premium-elements' ]; |
| 53 | } |
| 54 | |
| 55 | public function get_style_depends() { |
| 56 | return [ |
| 57 | 'premium-addons' |
| 58 | ]; |
| 59 | } |
| 60 | |
| 61 | public function get_script_depends() { |
| 62 | return [ |
| 63 | 'tilt-js', |
| 64 | 'premium-addons' |
| 65 | ]; |
| 66 | } |
| 67 | |
| 68 | public function get_custom_help_url() { |
| 69 | return 'https://premiumaddons.com/support/'; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Register Banner controls. |
| 74 | * |
| 75 | * @since 1.0.0 |
| 76 | * @access protected |
| 77 | */ |
| 78 | protected function _register_controls() { |
| 79 | |
| 80 | $this->start_controls_section('premium_banner_global_settings', |
| 81 | [ |
| 82 | 'label' => __( 'Image', 'premium-addons-for-elementor' ) |
| 83 | ] |
| 84 | ); |
| 85 | |
| 86 | $this->add_control('premium_banner_image', |
| 87 | [ |
| 88 | 'label' => __( 'Upload Image', 'premium-addons-for-elementor' ), |
| 89 | 'description' => __( 'Select an image for the Banner', 'premium-addons-for-elementor' ), |
| 90 | 'type' => Controls_Manager::MEDIA, |
| 91 | 'dynamic' => [ 'active' => true ], |
| 92 | 'default' => [ |
| 93 | 'url' => Utils::get_placeholder_image_src() |
| 94 | ], |
| 95 | 'show_external' => true |
| 96 | ] |
| 97 | ); |
| 98 | |
| 99 | $this->add_group_control( |
| 100 | Group_Control_Image_Size::get_type(), |
| 101 | [ |
| 102 | 'name' => 'thumbnail', |
| 103 | 'default' => 'full', |
| 104 | 'separator' => 'none', |
| 105 | ] |
| 106 | ); |
| 107 | |
| 108 | $this->add_control('premium_banner_link_url_switch', |
| 109 | [ |
| 110 | 'label' => __('Link', 'premium-addons-for-elementor'), |
| 111 | 'type' => Controls_Manager::SWITCHER |
| 112 | ] |
| 113 | ); |
| 114 | |
| 115 | $this->add_control('premium_banner_image_link_switcher', |
| 116 | [ |
| 117 | 'label' => __( 'Custom Link', 'premium-addons-for-elementor' ), |
| 118 | 'type' => Controls_Manager::SWITCHER, |
| 119 | 'description' => __( 'Add a custom link to the banner', 'premium-addons-for-elementor' ), |
| 120 | 'condition' => [ |
| 121 | 'premium_banner_link_url_switch' => 'yes', |
| 122 | ], |
| 123 | ] |
| 124 | ); |
| 125 | |
| 126 | $this->add_control('premium_banner_image_custom_link', |
| 127 | [ |
| 128 | 'label' => __( 'Set custom Link', 'premium-addons-for-elementor' ), |
| 129 | 'type' => Controls_Manager::URL, |
| 130 | 'dynamic' => [ 'active' => true ], |
| 131 | 'description' => __( 'What custom link you want to set to banner?', 'premium-addons-for-elementor' ), |
| 132 | 'condition' => [ |
| 133 | 'premium_banner_image_link_switcher' => 'yes', |
| 134 | 'premium_banner_link_url_switch' => 'yes' |
| 135 | ], |
| 136 | 'show_external' => false |
| 137 | ] |
| 138 | ); |
| 139 | |
| 140 | $this->add_control('premium_banner_image_existing_page_link', |
| 141 | [ |
| 142 | 'label' => __( 'Existing Page', 'premium-addons-for-elementor' ), |
| 143 | 'type' => Controls_Manager::SELECT2, |
| 144 | 'condition' => [ |
| 145 | 'premium_banner_image_link_switcher!' => 'yes', |
| 146 | 'premium_banner_link_url_switch' => 'yes' |
| 147 | ], |
| 148 | 'label_block' => true, |
| 149 | 'multiple' => false, |
| 150 | 'options' => $this->getTemplateInstance()->get_all_posts() |
| 151 | ] |
| 152 | ); |
| 153 | |
| 154 | $this->add_control('premium_banner_link_title', |
| 155 | [ |
| 156 | 'label' => __( 'Link Title', 'premium-addons-for-elementor' ), |
| 157 | 'type' => Controls_Manager::TEXT, |
| 158 | 'dynamic' => [ 'active' => true ], |
| 159 | 'condition' => [ |
| 160 | 'premium_banner_link_url_switch' => 'yes' |
| 161 | ] |
| 162 | ] |
| 163 | ); |
| 164 | |
| 165 | |
| 166 | $this->add_control('premium_banner_image_link_open_new_tab', |
| 167 | [ |
| 168 | 'label' => __( 'New Tab', 'premium-addons-for-elementor' ), |
| 169 | 'type' => Controls_Manager::SWITCHER, |
| 170 | 'description' => __( 'Choose if you want the link be opened in a new tab or not', 'premium-addons-for-elementor' ), |
| 171 | 'condition' => [ |
| 172 | 'premium_banner_link_url_switch' => 'yes' |
| 173 | ] |
| 174 | ] |
| 175 | ); |
| 176 | |
| 177 | $this->add_control('premium_banner_image_link_add_nofollow', |
| 178 | [ |
| 179 | 'label' => __( 'Nofollow Option', 'premium-addons-for-elementor' ), |
| 180 | 'type' => Controls_Manager::SWITCHER, |
| 181 | 'description' => __('if you choose yes, the link will not be counted in search engines', 'premium-addons-for-elementor' ), |
| 182 | 'condition' => [ |
| 183 | 'premium_banner_link_url_switch' => 'yes' |
| 184 | ] |
| 185 | ] |
| 186 | ); |
| 187 | |
| 188 | $this->add_control('premium_banner_image_animation', |
| 189 | [ |
| 190 | 'label' => __( 'Effect', 'premium-addons-for-elementor' ), |
| 191 | 'type' => Controls_Manager::SELECT, |
| 192 | 'default' => 'animation1', |
| 193 | 'description' => __( 'Choose a hover effect for the banner', 'premium-addons-for-elementor' ), |
| 194 | 'options' => [ |
| 195 | 'animation1' => __('Effect 1', 'premium-addons-for-elementor'), |
| 196 | 'animation5' => __('Effect 2', 'premium-addons-for-elementor'), |
| 197 | 'animation13' => __('Effect 3', 'premium-addons-for-elementor'), |
| 198 | 'animation2' => __('Effect 4', 'premium-addons-for-elementor'), |
| 199 | 'animation4' => __('Effect 5', 'premium-addons-for-elementor'), |
| 200 | 'animation6' => __('Effect 6', 'premium-addons-for-elementor'), |
| 201 | 'animation7' => __('Effect 7', 'premium-addons-for-elementor'), |
| 202 | 'animation8' => __('Effect 8', 'premium-addons-for-elementor'), |
| 203 | 'animation9' => __('Effect 9', 'premium-addons-for-elementor'), |
| 204 | 'animation10' => __('Effect 10', 'premium-addons-for-elementor'), |
| 205 | ] |
| 206 | ] |
| 207 | ); |
| 208 | |
| 209 | $this->add_control('premium_banner_active', |
| 210 | [ |
| 211 | 'label' => __( 'Always Hovered', 'premium-addons-for-elementor' ), |
| 212 | 'type' => Controls_Manager::SWITCHER, |
| 213 | 'description' => __( 'Choose if you want the effect to be always triggered', 'premium-addons-for-elementor' ) |
| 214 | ] |
| 215 | ); |
| 216 | |
| 217 | $this->add_control('premium_banner_hover_effect', |
| 218 | [ |
| 219 | 'label' => __('Hover Effect', 'premium-addons-for-elementor'), |
| 220 | 'type' => Controls_Manager::SELECT, |
| 221 | 'options' => [ |
| 222 | 'none' => __('None', 'premium-addons-for-elementor'), |
| 223 | 'zoomin' => __('Zoom In', 'premium-addons-for-elementor'), |
| 224 | 'zoomout' => __('Zoom Out', 'premium-addons-for-elementor'), |
| 225 | 'scale' => __('Scale', 'premium-addons-for-elementor'), |
| 226 | 'grayscale' => __('Grayscale', 'premium-addons-for-elementor'), |
| 227 | 'blur' => __('Blur', 'premium-addons-for-elementor'), |
| 228 | 'bright' => __('Bright', 'premium-addons-for-elementor'), |
| 229 | 'sepia' => __('Sepia', 'premium-addons-for-elementor'), |
| 230 | ], |
| 231 | 'default' => 'none', |
| 232 | ] |
| 233 | ); |
| 234 | |
| 235 | $this->add_control('premium_banner_height', |
| 236 | [ |
| 237 | 'label' => __( 'Height', 'premium-addons-for-elementor' ), |
| 238 | 'type' => Controls_Manager::SELECT, |
| 239 | 'options' => [ |
| 240 | 'default' => __('Default', 'premium-addons-for-elementor'), |
| 241 | 'custom' => __('Custom', 'premium-addons-for-elementor') |
| 242 | ], |
| 243 | 'default' => 'default', |
| 244 | 'description' => __( 'Choose if you want to set a custom height for the banner or keep it as it is', 'premium-addons-for-elementor' ) |
| 245 | ] |
| 246 | ); |
| 247 | |
| 248 | $this->add_responsive_control('premium_banner_custom_height', |
| 249 | [ |
| 250 | 'label' => __( 'Min Height', 'premium-addons-for-elementor' ), |
| 251 | 'type' => Controls_Manager::NUMBER, |
| 252 | 'description' => __( 'Set a minimum height value in pixels', 'premium-addons-for-elementor' ), |
| 253 | 'condition' => [ |
| 254 | 'premium_banner_height' => 'custom' |
| 255 | ], |
| 256 | 'selectors' => [ |
| 257 | '{{WRAPPER}} .premium-banner-ib' => 'height: {{VALUE}}px;' |
| 258 | ] |
| 259 | ] |
| 260 | ); |
| 261 | |
| 262 | $this->add_responsive_control('premium_banner_img_vertical_align', |
| 263 | [ |
| 264 | 'label' => __( 'Vertical Align', 'premium-addons-for-elementor' ), |
| 265 | 'type' => Controls_Manager::SELECT, |
| 266 | 'condition' => [ |
| 267 | 'premium_banner_height' => 'custom' |
| 268 | ], |
| 269 | 'options' => [ |
| 270 | 'flex-start' => __('Top', 'premium-addons-for-elementor'), |
| 271 | 'center' => __('Middle', 'premium-addons-for-elementor'), |
| 272 | 'flex-end' => __('Bottom', 'premium-addons-for-elementor'), |
| 273 | 'inherit' => __('Full', 'premium-addons-for-elementor') |
| 274 | ], |
| 275 | 'default' => 'flex-start', |
| 276 | 'selectors' => [ |
| 277 | '{{WRAPPER}} .premium-banner-img-wrap' => 'align-items: {{VALUE}}; -webkit-align-items: {{VALUE}};' |
| 278 | ] |
| 279 | ] |
| 280 | ); |
| 281 | |
| 282 | $this->add_control('mouse_tilt', |
| 283 | [ |
| 284 | 'label' => __('Enable Mouse Tilt', 'premium-addons-for-elementor'), |
| 285 | 'type' => Controls_Manager::SWITCHER, |
| 286 | 'return_value' => 'true' |
| 287 | ] |
| 288 | ); |
| 289 | |
| 290 | $this->add_control('mouse_tilt_rev', |
| 291 | [ |
| 292 | 'label' => __('Reverse', 'premium-addons-for-elementor'), |
| 293 | 'type' => Controls_Manager::SWITCHER, |
| 294 | 'return_value' => 'true', |
| 295 | 'condition' => [ |
| 296 | 'mouse_tilt' => 'true' |
| 297 | ] |
| 298 | ] |
| 299 | ); |
| 300 | |
| 301 | $this->add_control('premium_banner_extra_class', |
| 302 | [ |
| 303 | 'label' => __( 'Extra Class', 'premium-addons-for-elementor' ), |
| 304 | 'type' => Controls_Manager::TEXT, |
| 305 | 'dynamic' => [ 'active' => true ], |
| 306 | 'description' => __( 'Add extra class name that will be applied to the banner, and you can use this class for your customizations.', 'premium-addons-for-elementor' ) |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | |
| 311 | $this->end_controls_section(); |
| 312 | |
| 313 | $this->start_controls_section('premium_banner_image_section', |
| 314 | [ |
| 315 | 'label' => __( 'Content', 'premium-addons-for-elementor' ) |
| 316 | ] |
| 317 | ); |
| 318 | |
| 319 | $this->add_control('premium_banner_title', |
| 320 | [ |
| 321 | 'label' => __( 'Title', 'premium-addons-for-elementor' ), |
| 322 | 'placeholder' => __( 'Give a title to this banner', 'premium-addons-for-elementor' ), |
| 323 | 'type' => Controls_Manager::TEXT, |
| 324 | 'dynamic' => [ 'active' => true ], |
| 325 | 'default' => __( 'Premium Banner', 'premium-addons-for-elementor' ), |
| 326 | 'label_block' => false |
| 327 | ] |
| 328 | ); |
| 329 | |
| 330 | $this->add_control('premium_banner_title_tag', |
| 331 | [ |
| 332 | 'label' => __( 'HTML Tag', 'premium-addons-for-elementor' ), |
| 333 | 'description' => __( 'Select a heading tag for the title. Headings are defined with H1 to H6 tags', 'premium-addons-for-elementor' ), |
| 334 | 'type' => Controls_Manager::SELECT, |
| 335 | 'default' => 'h3', |
| 336 | 'options' => [ |
| 337 | 'h1' => 'H1', |
| 338 | 'h2' => 'H2', |
| 339 | 'h3' => 'H3', |
| 340 | 'h4' => 'H4', |
| 341 | 'h5' => 'H5', |
| 342 | 'h6' => 'H6', |
| 343 | 'div' => 'div', |
| 344 | 'span' => 'span', |
| 345 | 'p' => 'p', |
| 346 | ], |
| 347 | 'label_block' => true, |
| 348 | ] |
| 349 | ); |
| 350 | |
| 351 | |
| 352 | $this->add_control('premium_banner_description_hint', |
| 353 | [ |
| 354 | 'label' => __( 'Description', 'premium-addons-for-elementor' ), |
| 355 | 'type' => Controls_Manager::HEADING, |
| 356 | ] |
| 357 | ); |
| 358 | |
| 359 | $this->add_control('premium_banner_description', |
| 360 | [ |
| 361 | 'label' => __( 'Description', 'premium-addons-for-elementor' ), |
| 362 | 'description' => __( 'Give the description to this banner', 'premium-addons-for-elementor' ), |
| 363 | 'type' => Controls_Manager::WYSIWYG, |
| 364 | 'dynamic' => [ 'active' => true ], |
| 365 | 'default' => __( 'Premium Banner gives you a wide range of styles and options that you will definitely fall in love with', 'premium-addons-for-elementor' ), |
| 366 | 'label_block' => true |
| 367 | ] |
| 368 | ); |
| 369 | |
| 370 | $this->add_control('premium_banner_link_switcher', |
| 371 | [ |
| 372 | 'label' => __('Button', 'premium-addons-for-elementor'), |
| 373 | 'type' => Controls_Manager::SWITCHER, |
| 374 | 'condition' => [ |
| 375 | 'premium_banner_link_url_switch!' => 'yes' |
| 376 | ] |
| 377 | ] |
| 378 | ); |
| 379 | |
| 380 | |
| 381 | $this->add_control('premium_banner_more_text', |
| 382 | [ |
| 383 | 'label' => __('Text','premium-addons-for-elementor'), |
| 384 | 'type' => Controls_Manager::TEXT, |
| 385 | 'dynamic' => [ 'active' => true ], |
| 386 | 'default' => 'Click Here', |
| 387 | 'condition' => [ |
| 388 | 'premium_banner_link_switcher' => 'yes', |
| 389 | 'premium_banner_link_url_switch!' => 'yes' |
| 390 | ] |
| 391 | ] |
| 392 | ); |
| 393 | |
| 394 | $this->add_control('premium_banner_link_selection', |
| 395 | [ |
| 396 | 'label' => __('Link Type', 'premium-addons-for-elementor'), |
| 397 | 'type' => Controls_Manager::SELECT, |
| 398 | 'options' => [ |
| 399 | 'url' => __('URL', 'premium-addons-for-elementor'), |
| 400 | 'link' => __('Existing Page', 'premium-addons-for-elementor'), |
| 401 | ], |
| 402 | 'default' => 'url', |
| 403 | 'label_block' => true, |
| 404 | 'condition' => [ |
| 405 | 'premium_banner_link_switcher' => 'yes', |
| 406 | 'premium_banner_link_url_switch!' => 'yes' |
| 407 | ] |
| 408 | ] |
| 409 | ); |
| 410 | |
| 411 | $this->add_control('premium_banner_link', |
| 412 | [ |
| 413 | 'label' => __('Link', 'premium-addons-for-elementor'), |
| 414 | 'type' => Controls_Manager::URL, |
| 415 | 'dynamic' => [ 'active' => true ], |
| 416 | 'default' => [ |
| 417 | 'url' => '#', |
| 418 | ], |
| 419 | 'placeholder' => 'https://premiumaddons.com/', |
| 420 | 'label_block' => true, |
| 421 | 'condition' => [ |
| 422 | 'premium_banner_link_selection' => 'url', |
| 423 | 'premium_banner_link_switcher' => 'yes', |
| 424 | 'premium_banner_link_url_switch!' => 'yes' |
| 425 | ] |
| 426 | ] |
| 427 | ); |
| 428 | |
| 429 | $this->add_control('premium_banner_existing_link', |
| 430 | [ |
| 431 | 'label' => __('Existing Page', 'premium-addons-for-elementor'), |
| 432 | 'type' => Controls_Manager::SELECT2, |
| 433 | 'options' => $this->getTemplateInstance()->get_all_posts(), |
| 434 | 'multiple' => false, |
| 435 | 'condition' => [ |
| 436 | 'premium_banner_link_selection' => 'link', |
| 437 | 'premium_banner_link_switcher' => 'yes', |
| 438 | 'premium_banner_link_url_switch!' => 'yes' |
| 439 | ], |
| 440 | 'label_block' => true |
| 441 | ] |
| 442 | ); |
| 443 | |
| 444 | |
| 445 | $this->add_control('premium_banner_title_text_align', |
| 446 | [ |
| 447 | 'label' => __('Alignment', 'premium-addons-for-elementor'), |
| 448 | 'type' => Controls_Manager::CHOOSE, |
| 449 | 'options' => [ |
| 450 | 'left' => [ |
| 451 | 'title' => __('Left', 'premium-addons-for-elementor'), |
| 452 | 'icon' => 'fa fa-align-left' |
| 453 | ], |
| 454 | 'center' => [ |
| 455 | 'title' => __('Center', 'premium-addons-for-elementor'), |
| 456 | 'icon' => 'fa fa-align-center' |
| 457 | ], |
| 458 | 'right' => [ |
| 459 | 'title' => __('Right', 'premium-addons-for-elementor'), |
| 460 | 'icon' => 'fa fa-align-right' |
| 461 | ], |
| 462 | ], |
| 463 | 'default' => 'left', |
| 464 | 'toggle' => false, |
| 465 | 'selectors' => [ |
| 466 | '{{WRAPPER}} .premium-banner-ib-title, {{WRAPPER}} .premium-banner-ib-content, {{WRAPPER}} .premium-banner-read-more' => 'text-align: {{VALUE}} ;', |
| 467 | ] |
| 468 | ] |
| 469 | ); |
| 470 | |
| 471 | $this->end_controls_section(); |
| 472 | |
| 473 | $this->start_controls_section('premium_banner_responsive_section', |
| 474 | [ |
| 475 | 'label' => __('Responsive', 'premium-addons-for-elementor'), |
| 476 | ] |
| 477 | ); |
| 478 | |
| 479 | $this->add_control('premium_banner_responsive_switcher', |
| 480 | [ |
| 481 | 'label' => __('Responsive Controls', 'premium-addons-for-elementor'), |
| 482 | 'type' => Controls_Manager::SWITCHER, |
| 483 | 'description' => __('If the description text is not suiting well on specific screen sizes, you may enable this option which will hide the description text.', 'premium-addons-for-elementor') |
| 484 | ] |
| 485 | ); |
| 486 | |
| 487 | $this->add_control('premium_banner_min_range', |
| 488 | [ |
| 489 | 'label' => __('Minimum Size', 'premium-addons-for-elementor'), |
| 490 | 'type' => Controls_Manager::NUMBER, |
| 491 | 'description'=> __('Note: minimum size for extra small screens is 1px.','premium-addons-for-elementor'), |
| 492 | 'default' => 1, |
| 493 | 'condition' => [ |
| 494 | 'premium_banner_responsive_switcher' => 'yes' |
| 495 | ], |
| 496 | ] |
| 497 | ); |
| 498 | |
| 499 | $this->add_control('premium_banner_max_range', |
| 500 | [ |
| 501 | 'label' => __('Maximum Size', 'premium-addons-for-elementor'), |
| 502 | 'type' => Controls_Manager::NUMBER, |
| 503 | 'description'=> __('Note: maximum size for extra small screens is 767px.','premium-addons-for-elementor'), |
| 504 | 'default' => 767, |
| 505 | 'condition' => [ |
| 506 | 'premium_banner_responsive_switcher' => 'yes' |
| 507 | ], |
| 508 | ] |
| 509 | ); |
| 510 | |
| 511 | $this->end_controls_section(); |
| 512 | |
| 513 | $this->start_controls_section('section_pa_docs', |
| 514 | [ |
| 515 | 'label' => __('Helpful Documentations', 'premium-addons-for-elementor'), |
| 516 | ] |
| 517 | ); |
| 518 | |
| 519 | $doc1_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-banner-widget/', 'editor-page', 'wp-editor', 'get-support' ); |
| 520 | |
| 521 | $this->add_control('doc_1', |
| 522 | [ |
| 523 | 'type' => Controls_Manager::RAW_HTML, |
| 524 | 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc1_url ,__( 'Gettings started »', 'premium-addons-for-elementor' ) ), |
| 525 | 'content_classes' => 'editor-pa-doc', |
| 526 | ] |
| 527 | ); |
| 528 | |
| 529 | $this->end_controls_section(); |
| 530 | |
| 531 | $this->start_controls_section('premium_banner_opacity_style', |
| 532 | [ |
| 533 | 'label' => __( 'General', 'premium-addons-for-elementor' ), |
| 534 | 'tab' => Controls_Manager::TAB_STYLE |
| 535 | ] |
| 536 | ); |
| 537 | |
| 538 | $this->add_control('premium_banner_image_bg_color', |
| 539 | [ |
| 540 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 541 | 'type' => Controls_Manager::COLOR, |
| 542 | 'selectors' => [ |
| 543 | '{{WRAPPER}} .premium-banner-ib' => 'background: {{VALUE}};' |
| 544 | ] |
| 545 | ] |
| 546 | ); |
| 547 | |
| 548 | $this->add_control('premium_banner_image_opacity', |
| 549 | [ |
| 550 | 'label' => __( 'Image Opacity', 'premium-addons-for-elementor' ), |
| 551 | 'type' => Controls_Manager::SLIDER, |
| 552 | 'default' => [ |
| 553 | 'size' => 1 |
| 554 | ], |
| 555 | 'range' => [ |
| 556 | 'px' => [ |
| 557 | 'min' => 0, |
| 558 | 'max' => 1, |
| 559 | 'step' => .1 |
| 560 | ] |
| 561 | ], |
| 562 | 'selectors' => [ |
| 563 | '{{WRAPPER}} .premium-banner-ib img' => 'opacity: {{SIZE}};' |
| 564 | ] |
| 565 | ] |
| 566 | ); |
| 567 | |
| 568 | $this->add_control('premium_banner_image_hover_opacity', |
| 569 | [ |
| 570 | 'label' => __( 'Hover Opacity', 'premium-addons-for-elementor' ), |
| 571 | 'type' => Controls_Manager::SLIDER, |
| 572 | 'default' => [ |
| 573 | 'size' => 1 |
| 574 | ], |
| 575 | 'range' => [ |
| 576 | 'px' => [ |
| 577 | 'min' => 0, |
| 578 | 'max' => 1, |
| 579 | 'step' => .1 |
| 580 | ] |
| 581 | ], |
| 582 | 'separator' => 'after', |
| 583 | 'selectors' => [ |
| 584 | '{{WRAPPER}} .premium-banner-ib img.active' => 'opacity: {{SIZE}};' |
| 585 | ] |
| 586 | ] |
| 587 | ); |
| 588 | |
| 589 | $this->add_control('premium_banner_title_border_width', |
| 590 | [ |
| 591 | 'label' => __( 'Hover Border Width', 'premium-addons-for-elementor' ), |
| 592 | 'type' => Controls_Manager::SLIDER, |
| 593 | 'size_units' => ['px', '%', 'em'], |
| 594 | 'condition' => [ |
| 595 | 'premium_banner_image_animation' => [ 'animation13','animation9','animation10' ] |
| 596 | ], |
| 597 | 'selectors' => [ |
| 598 | '{{WRAPPER}} .premium-banner-animation13 .premium-banner-ib-title::after' => 'height: {{size}}{{unit}};', |
| 599 | '{{WRAPPER}} .premium-banner-animation9 .premium-banner-ib-desc::before , {{WRAPPER}} .premium-banner-animation9 .premium-banner-ib-desc::after' => 'height: {{size}}{{unit}};', |
| 600 | '{{WRAPPER}} .premium-banner-animation10 .premium-banner-ib-title::after' => 'height: {{size}}{{unit}};', |
| 601 | ] |
| 602 | ] |
| 603 | ); |
| 604 | |
| 605 | $this->add_control('premium_banner_style3_title_border', |
| 606 | [ |
| 607 | 'label' => __( 'Hover Border Color', 'premium-addons-for-elementor' ), |
| 608 | 'type' => Controls_Manager::COLOR, |
| 609 | 'condition' => [ |
| 610 | 'premium_banner_image_animation' => [ 'animation13','animation9','animation10' ] |
| 611 | ], |
| 612 | 'separator' => 'after', |
| 613 | 'selectors' => [ |
| 614 | '{{WRAPPER}} .premium-banner-animation13 .premium-banner-ib-title::after' => 'background: {{VALUE}};', |
| 615 | '{{WRAPPER}} .premium-banner-animation9 .premium-banner-ib-desc::before , {{WRAPPER}} .premium-banner-animation9 .premium-banner-ib-desc::after' => 'background: {{VALUE}};', |
| 616 | '{{WRAPPER}} .premium-banner-animation10 .premium-banner-ib-title::after' => 'background: {{VALUE}};', |
| 617 | ] |
| 618 | ] |
| 619 | ); |
| 620 | |
| 621 | $this->add_control('premium_banner_inner_border_width', |
| 622 | [ |
| 623 | 'label' => __( 'Hover Border Width', 'premium-addons-for-elementor' ), |
| 624 | 'type' => Controls_Manager::SLIDER, |
| 625 | 'size_units' => ['px', '%', 'em'], |
| 626 | 'condition' => [ |
| 627 | 'premium_banner_image_animation' => [ 'animation4', 'animation6', 'animation7' , 'animation8' ] |
| 628 | ], |
| 629 | 'selectors' => [ |
| 630 | '{{WRAPPER}} .premium-banner-animation4 .premium-banner-ib-desc::after, {{WRAPPER}} .premium-banner-animation4 .premium-banner-ib-desc::before, {{WRAPPER}} .premium-banner-animation6 .premium-banner-ib-desc::before' => 'border-width: {{size}}{{unit}};', |
| 631 | '{{WRAPPER}} .premium-banner-animation7 .premium-banner-br.premium-banner-bleft ,{{WRAPPER}} .premium-banner-animation7 .premium-banner-br.premium-banner-bright , {{WRAPPER}} .premium-banner-animation8 .premium-banner-br.premium-banner-bright,{{WRAPPER}} .premium-banner-animation8 .premium-banner-br.premium-banner-bleft' => 'width: {{size}}{{unit}};', |
| 632 | '{{WRAPPER}} .premium-banner-animation7 .premium-banner-br.premium-banner-btop , {{WRAPPER}} .premium-banner-animation7 .premium-banner-br.premium-banner-bottom , {{WRAPPER}} .premium-banner-animation8 .premium-banner-br.premium-banner-bottom,{{WRAPPER}} .premium-banner-animation8 .premium-banner-br.premium-banner-btop ' => 'height: {{size}}{{unit}};' |
| 633 | ], |
| 634 | ] |
| 635 | ); |
| 636 | |
| 637 | $this->add_control('premium_banner_scaled_border_color', |
| 638 | [ |
| 639 | 'label' => __( 'Hover Border Color', 'premium-addons-for-elementor' ), |
| 640 | 'type' => Controls_Manager::COLOR, |
| 641 | 'condition' => [ |
| 642 | 'premium_banner_image_animation' => [ 'animation4', 'animation6', 'animation7' , 'animation8' ] |
| 643 | ], |
| 644 | 'separator' => 'after', |
| 645 | 'selectors' => [ |
| 646 | '{{WRAPPER}} .premium-banner-animation4 .premium-banner-ib-desc::after, {{WRAPPER}} .premium-banner-animation4 .premium-banner-ib-desc::before, {{WRAPPER}} .premium-banner-animation6 .premium-banner-ib-desc::before' => 'border-color: {{VALUE}};', |
| 647 | '{{WRAPPER}} .premium-banner-animation7 .premium-banner-br , {{WRAPPER}} .premium-banner-animation8 .premium-banner-br' => 'background-color: {{VALUE}};' |
| 648 | ], |
| 649 | ] |
| 650 | ); |
| 651 | |
| 652 | $this->add_group_control( |
| 653 | Group_Control_Css_Filter::get_type(), |
| 654 | [ |
| 655 | 'name' => 'css_filters', |
| 656 | 'selector' => '{{WRAPPER}} .premium-banner-ib img', |
| 657 | ] |
| 658 | ); |
| 659 | |
| 660 | $this->add_group_control( |
| 661 | Group_Control_Css_Filter::get_type(), |
| 662 | [ |
| 663 | 'name' => 'hover_css_filters', |
| 664 | 'label' => __('Hover CSS Filters', 'premium-addons-for-elementor'), |
| 665 | 'selector' => '{{WRAPPER}} .premium-banner-ib img.active' |
| 666 | ] |
| 667 | ); |
| 668 | |
| 669 | $this->add_group_control( |
| 670 | Group_Control_Border::get_type(), |
| 671 | [ |
| 672 | 'name' => 'premium_banner_image_border', |
| 673 | 'selector' => '{{WRAPPER}} .premium-banner-ib' |
| 674 | ] |
| 675 | ); |
| 676 | |
| 677 | $this->add_responsive_control( |
| 678 | 'premium_banner_image_border_radius', |
| 679 | [ |
| 680 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 681 | 'type' => Controls_Manager::SLIDER, |
| 682 | 'size_units' => ['px', '%' ,'em'], |
| 683 | 'selectors' => [ |
| 684 | '{{WRAPPER}} .premium-banner-ib' => 'border-radius: {{SIZE}}{{UNIT}};' |
| 685 | ] |
| 686 | ] |
| 687 | ); |
| 688 | |
| 689 | $this->add_control('blend_mode', |
| 690 | [ |
| 691 | 'label' => __( 'Blend Mode', 'elementor' ), |
| 692 | 'type' => Controls_Manager::SELECT, |
| 693 | 'options' => [ |
| 694 | '' => __( 'Normal', 'elementor' ), |
| 695 | 'multiply' => 'Multiply', |
| 696 | 'screen' => 'Screen', |
| 697 | 'overlay' => 'Overlay', |
| 698 | 'darken' => 'Darken', |
| 699 | 'lighten' => 'Lighten', |
| 700 | 'color-dodge' => 'Color Dodge', |
| 701 | 'saturation' => 'Saturation', |
| 702 | 'color' => 'Color', |
| 703 | 'luminosity' => 'Luminosity', |
| 704 | ], |
| 705 | 'separator' => 'before', |
| 706 | 'selectors' => [ |
| 707 | '{{WRAPPER}} .premium-banner-ib' => 'mix-blend-mode: {{VALUE}}', |
| 708 | ], |
| 709 | ] |
| 710 | ); |
| 711 | |
| 712 | $this->end_controls_section(); |
| 713 | |
| 714 | $this->start_controls_section('premium_banner_title_style', |
| 715 | [ |
| 716 | 'label' => __( 'Title', 'premium-addons-for-elementor' ), |
| 717 | 'tab' => Controls_Manager::TAB_STYLE |
| 718 | ] |
| 719 | ); |
| 720 | |
| 721 | $this->add_control('premium_banner_color_of_title', |
| 722 | [ |
| 723 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 724 | 'type' => Controls_Manager::COLOR, |
| 725 | 'scheme' => [ |
| 726 | 'type' => Scheme_Color::get_type(), |
| 727 | 'value' => Scheme_Color::COLOR_1 |
| 728 | ], |
| 729 | 'selectors' => [ |
| 730 | '{{WRAPPER}} .premium-banner-ib-desc .premium_banner_title' => 'color: {{VALUE}};' |
| 731 | ] |
| 732 | ] |
| 733 | ); |
| 734 | |
| 735 | $this->add_group_control( |
| 736 | Group_Control_Typography::get_type(), |
| 737 | [ |
| 738 | 'name' => 'premium_banner_title_typography', |
| 739 | 'selector' => '{{WRAPPER}} .premium-banner-ib-desc .premium_banner_title', |
| 740 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1 |
| 741 | ] |
| 742 | ); |
| 743 | |
| 744 | $this->add_control('premium_banner_style2_title_bg', |
| 745 | [ |
| 746 | 'label' => __( 'Background', 'premium-addons-for-elementor' ), |
| 747 | 'type' => Controls_Manager::COLOR, |
| 748 | 'default' => '#f2f2f2', |
| 749 | 'description' => __( 'Choose a background color for the title', 'premium-addons-for-elementor' ), |
| 750 | 'condition' => [ |
| 751 | 'premium_banner_image_animation' => 'animation5' |
| 752 | ], |
| 753 | 'selectors' => [ |
| 754 | '{{WRAPPER}} .premium-banner-animation5 .premium-banner-ib-desc' => 'background: {{VALUE}};', |
| 755 | ] |
| 756 | ] |
| 757 | ); |
| 758 | |
| 759 | $this->add_group_control( |
| 760 | Group_Control_Text_Shadow::get_type(), |
| 761 | [ |
| 762 | 'label' => __('Shadow','premium-addons-for-elementor'), |
| 763 | 'name' => 'premium_banner_title_shadow', |
| 764 | 'selector' => '{{WRAPPER}} .premium-banner-ib-desc .premium_banner_title' |
| 765 | ] |
| 766 | ); |
| 767 | |
| 768 | $this->add_responsive_control('premium_banner_title_margin', |
| 769 | [ |
| 770 | 'label' => __('Margin', 'premium-addons-for-elementor'), |
| 771 | 'type' => Controls_Manager::DIMENSIONS, |
| 772 | 'size_units' => ['px', 'em', '%'], |
| 773 | 'selectors' => [ |
| 774 | '{{WRAPPER}} .premium-banner-ib-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 775 | ] |
| 776 | ] |
| 777 | ); |
| 778 | |
| 779 | $this->end_controls_section(); |
| 780 | |
| 781 | $this->start_controls_section('premium_banner_styles_of_content', |
| 782 | [ |
| 783 | 'label' => __( 'Description', 'premium-addons-for-elementor' ), |
| 784 | 'tab' => Controls_Manager::TAB_STYLE |
| 785 | ] |
| 786 | ); |
| 787 | |
| 788 | $this->add_control('premium_banner_color_of_content', |
| 789 | [ |
| 790 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 791 | 'type' => Controls_Manager::COLOR, |
| 792 | 'scheme' => [ |
| 793 | 'type' => Scheme_Color::get_type(), |
| 794 | 'value' => Scheme_Color::COLOR_3 |
| 795 | ], |
| 796 | 'selectors' => [ |
| 797 | '{{WRAPPER}} .premium-banner .premium_banner_content' => 'color: {{VALUE}};' |
| 798 | ], |
| 799 | ] |
| 800 | ); |
| 801 | |
| 802 | $this->add_group_control( |
| 803 | Group_Control_Typography::get_type(), |
| 804 | [ |
| 805 | 'name' => 'premium_banner_content_typhography', |
| 806 | 'selector' => '{{WRAPPER}} .premium-banner .premium_banner_content', |
| 807 | 'scheme' => Scheme_Typography::TYPOGRAPHY_3, |
| 808 | ] |
| 809 | ); |
| 810 | |
| 811 | $this->add_group_control( |
| 812 | Group_Control_Text_Shadow::get_type(), |
| 813 | [ |
| 814 | 'label' => __('Shadow','premium-addons-for-elementor'), |
| 815 | 'name' => 'premium_banner_description_shadow', |
| 816 | 'selector' => '{{WRAPPER}} .premium-banner .premium_banner_content', |
| 817 | ] |
| 818 | ); |
| 819 | |
| 820 | $this->add_responsive_control('premium_banner_desc_margin', |
| 821 | [ |
| 822 | 'label' => __('Margin', 'premium-addons-for-elementor'), |
| 823 | 'type' => Controls_Manager::DIMENSIONS, |
| 824 | 'size_units' => ['px', 'em', '%'], |
| 825 | 'selectors' => [ |
| 826 | '{{WRAPPER}} .premium-banner-ib-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 827 | ] |
| 828 | ] |
| 829 | ); |
| 830 | |
| 831 | $this->end_controls_section(); |
| 832 | |
| 833 | $this->start_controls_section('premium_banner_styles_of_button', |
| 834 | [ |
| 835 | 'label' => __( 'Button', 'premium-addons-for-elementor' ), |
| 836 | 'tab' => Controls_Manager::TAB_STYLE, |
| 837 | 'condition' => [ |
| 838 | 'premium_banner_link_switcher' => 'yes', |
| 839 | 'premium_banner_link_url_switch!' => 'yes' |
| 840 | ] |
| 841 | ] |
| 842 | ); |
| 843 | |
| 844 | $this->add_control('premium_banner_color_of_button', |
| 845 | [ |
| 846 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 847 | 'type' => Controls_Manager::COLOR, |
| 848 | 'scheme' => [ |
| 849 | 'type' => Scheme_Color::get_type(), |
| 850 | 'value' => Scheme_Color::COLOR_3 |
| 851 | ], |
| 852 | 'selectors' => [ |
| 853 | '{{WRAPPER}} .premium-banner .premium-banner-link' => 'color: {{VALUE}};' |
| 854 | ] |
| 855 | ] |
| 856 | ); |
| 857 | |
| 858 | $this->add_control('premium_banner_hover_color_of_button', |
| 859 | [ |
| 860 | 'label' => __( 'Hover Color', 'premium-addons-for-elementor' ), |
| 861 | 'type' => Controls_Manager::COLOR, |
| 862 | 'scheme' => [ |
| 863 | 'type' => Scheme_Color::get_type(), |
| 864 | 'value' => Scheme_Color::COLOR_3, |
| 865 | ], |
| 866 | 'selectors' => [ |
| 867 | '{{WRAPPER}} .premium-banner .premium-banner-link:hover' => 'color: {{VALUE}};' |
| 868 | ] |
| 869 | ] |
| 870 | ); |
| 871 | |
| 872 | $this->add_group_control( |
| 873 | Group_Control_Typography::get_type(), |
| 874 | [ |
| 875 | 'name' => 'premium_banner_button_typhography', |
| 876 | 'scheme' => Scheme_Typography::TYPOGRAPHY_3, |
| 877 | 'selector' => '{{WRAPPER}} .premium-banner-link', |
| 878 | ] |
| 879 | ); |
| 880 | |
| 881 | $this->add_control('premium_banner_backcolor_of_button', |
| 882 | [ |
| 883 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 884 | 'type' => Controls_Manager::COLOR, |
| 885 | 'selectors' => [ |
| 886 | '{{WRAPPER}} .premium-banner .premium-banner-link' => 'background-color: {{VALUE}};' |
| 887 | ], |
| 888 | ] |
| 889 | ); |
| 890 | |
| 891 | $this->add_control('premium_banner_hover_backcolor_of_button', |
| 892 | [ |
| 893 | 'label' => __( 'Hover Background Color', 'premium-addons-for-elementor' ), |
| 894 | 'type' => Controls_Manager::COLOR, |
| 895 | 'selectors' => [ |
| 896 | '{{WRAPPER}} .premium-banner .premium-banner-link:hover' => 'background-color: {{VALUE}};' |
| 897 | ] |
| 898 | ] |
| 899 | ); |
| 900 | |
| 901 | $this->add_group_control( |
| 902 | Group_Control_Border::get_type(), |
| 903 | [ |
| 904 | 'name' => 'premium_banner_button_border', |
| 905 | 'selector' => '{{WRAPPER}} .premium-banner .premium-banner-link' |
| 906 | ] |
| 907 | ); |
| 908 | |
| 909 | $this->add_control('premium_banner_button_border_radius', |
| 910 | [ |
| 911 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 912 | 'type' => Controls_Manager::SLIDER, |
| 913 | 'size_units' => ['px', '%' ,'em'], |
| 914 | 'selectors' => [ |
| 915 | '{{WRAPPER}} .premium-banner-link' => 'border-radius: {{SIZE}}{{UNIT}};' |
| 916 | ] |
| 917 | ] |
| 918 | ); |
| 919 | |
| 920 | $this->add_group_control( |
| 921 | Group_Control_Text_Shadow::get_type(), |
| 922 | [ |
| 923 | 'label' => __('Shadow','premium-addons-for-elementor'), |
| 924 | 'name' => 'premium_banner_button_shadow', |
| 925 | 'selector' => '{{WRAPPER}} .premium-banner .premium-banner-link', |
| 926 | ] |
| 927 | ); |
| 928 | |
| 929 | $this->add_responsive_control('premium_banner_button_margin', |
| 930 | [ |
| 931 | 'label' => __('Margin', 'premium-addons-for-elementor'), |
| 932 | 'type' => Controls_Manager::DIMENSIONS, |
| 933 | 'size_units' => ['px', 'em', '%'], |
| 934 | 'selectors' => [ |
| 935 | '{{WRAPPER}} .premium-banner-read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 936 | ] |
| 937 | ] |
| 938 | ); |
| 939 | |
| 940 | $this->add_responsive_control('premium_banner_button_padding', |
| 941 | [ |
| 942 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 943 | 'type' => Controls_Manager::DIMENSIONS, |
| 944 | 'size_units' => ['px', 'em', '%'], |
| 945 | 'selectors' => [ |
| 946 | '{{WRAPPER}} .premium-banner-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 947 | ] |
| 948 | ] |
| 949 | ); |
| 950 | |
| 951 | $this->end_controls_section(); |
| 952 | |
| 953 | $this->start_controls_section('premium_banner_container_style', |
| 954 | [ |
| 955 | 'label' => __( 'Container', 'premium-addons-for-elementor' ), |
| 956 | 'tab' => Controls_Manager::TAB_STYLE |
| 957 | ] |
| 958 | ); |
| 959 | |
| 960 | $this->add_group_control( |
| 961 | Group_Control_Border::get_type(), |
| 962 | [ |
| 963 | 'name' => 'premium_banner_border', |
| 964 | 'selector' => '{{WRAPPER}} .premium-banner' |
| 965 | ] |
| 966 | ); |
| 967 | |
| 968 | $this->add_control('premium_banner_border_radius', |
| 969 | [ |
| 970 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 971 | 'type' => Controls_Manager::DIMENSIONS, |
| 972 | 'size_units' => ['px', '%' ,'em'], |
| 973 | 'selectors' => [ |
| 974 | '{{WRAPPER}} .premium-banner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 975 | ] |
| 976 | ] |
| 977 | ); |
| 978 | |
| 979 | $this->add_group_control( |
| 980 | Group_Control_Box_Shadow::get_type(), |
| 981 | [ |
| 982 | 'name' => 'premium_banner_shadow', |
| 983 | 'selector' => '{{WRAPPER}} .premium-banner', |
| 984 | ] |
| 985 | ); |
| 986 | |
| 987 | $this->end_controls_section(); |
| 988 | |
| 989 | } |
| 990 | |
| 991 | /** |
| 992 | * Render Banner widget output on the frontend. |
| 993 | * |
| 994 | * Written in PHP and used to generate the final HTML. |
| 995 | * |
| 996 | * @since 1.0.0 |
| 997 | * @access protected |
| 998 | */ |
| 999 | protected function render() { |
| 1000 | |
| 1001 | $settings = $this->get_settings_for_display(); |
| 1002 | |
| 1003 | $this->add_render_attribute( 'banner', 'id', 'premium-banner-' . $this->get_id() ); |
| 1004 | $this->add_render_attribute( 'banner', 'class', 'premium-banner' ); |
| 1005 | |
| 1006 | if( 'true' === $settings['mouse_tilt'] ) { |
| 1007 | $this->add_render_attribute( 'banner', 'data-box-tilt', 'true' ); |
| 1008 | if( 'true' === $settings['mouse_tilt_rev'] ) { |
| 1009 | $this->add_render_attribute( 'banner', 'data-box-tilt-reverse', 'true' ); |
| 1010 | } |
| 1011 | } |
| 1012 | |
| 1013 | |
| 1014 | $this->add_inline_editing_attributes('premium_banner_title'); |
| 1015 | $this->add_render_attribute('premium_banner_title', 'class', array( |
| 1016 | 'premium-banner-ib-title', |
| 1017 | 'premium_banner_title' |
| 1018 | )); |
| 1019 | |
| 1020 | $this->add_inline_editing_attributes('premium_banner_description', 'advanced'); |
| 1021 | |
| 1022 | $title_tag = $settings[ 'premium_banner_title_tag' ]; |
| 1023 | $title = $settings[ 'premium_banner_title' ]; |
| 1024 | $full_title = '<div class="premium-banner-title-wrap"><'. $title_tag . ' ' . $this->get_render_attribute_string('premium_banner_title') .'>' .$title. '</'.$title_tag.'></div>'; |
| 1025 | |
| 1026 | $link = 'yes' == $settings['premium_banner_image_link_switcher'] ? $settings['premium_banner_image_custom_link']['url'] : get_permalink( $settings['premium_banner_image_existing_page_link'] ); |
| 1027 | |
| 1028 | $link_title = $settings['premium_banner_link_url_switch'] === 'yes' ? $settings['premium_banner_link_title'] : ''; |
| 1029 | |
| 1030 | $open_new_tab = $settings['premium_banner_image_link_open_new_tab'] == 'yes' ? ' target="_blank"' : ''; |
| 1031 | $nofollow_link = $settings['premium_banner_image_link_add_nofollow'] == 'yes' ? ' rel="nofollow"' : ''; |
| 1032 | $full_link = '<a class="premium-banner-ib-link" href="'. $link .'" title="'. $link_title .'"'. $open_new_tab . $nofollow_link . '></a>'; |
| 1033 | $animation_class = 'premium-banner-' . $settings['premium_banner_image_animation']; |
| 1034 | $hover_class = ' ' . $settings['premium_banner_hover_effect']; |
| 1035 | $extra_class = ! empty( $settings['premium_banner_extra_class'] ) ? ' '. $settings['premium_banner_extra_class'] : ''; |
| 1036 | $active = $settings['premium_banner_active'] == 'yes' ? ' active' : ''; |
| 1037 | $full_class = $animation_class.$hover_class.$extra_class.$active; |
| 1038 | $min_size = $settings['premium_banner_min_range'] .'px'; |
| 1039 | $max_size = $settings['premium_banner_max_range'] .'px'; |
| 1040 | |
| 1041 | |
| 1042 | $banner_url = 'url' == $settings['premium_banner_link_selection'] ? $settings['premium_banner_link']['url'] : get_permalink( $settings['premium_banner_existing_link'] ); |
| 1043 | |
| 1044 | $image_html = ''; |
| 1045 | if ( ! empty( $settings['premium_banner_image']['url'] ) ) { |
| 1046 | |
| 1047 | $this->add_render_attribute( 'image', 'src', $settings['premium_banner_image']['url'] ); |
| 1048 | $this->add_render_attribute( 'image', 'alt', Control_Media::get_image_alt( $settings['premium_banner_image'] ) ); |
| 1049 | |
| 1050 | $this->add_render_attribute( 'image', 'title', Control_Media::get_image_title( $settings['premium_banner_image'] ) ); |
| 1051 | |
| 1052 | $image_html = Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail', 'premium_banner_image' ); |
| 1053 | |
| 1054 | } |
| 1055 | |
| 1056 | ?> |
| 1057 | <div <?php echo $this->get_render_attribute_string('banner'); ?>> |
| 1058 | <div class="premium-banner-ib <?php echo $full_class; ?> premium-banner-min-height"> |
| 1059 | <?php if( ! empty( $settings['premium_banner_image']['url'] ) ) : ?> |
| 1060 | <?php if( $settings['premium_banner_height'] == 'custom' ) : ?> |
| 1061 | <div class="premium-banner-img-wrap"> |
| 1062 | <?php endif; |
| 1063 | echo $image_html; |
| 1064 | if( $settings['premium_banner_height'] == 'custom' ): ?> |
| 1065 | </div> |
| 1066 | <?php endif; |
| 1067 | endif; ?> |
| 1068 | <div class="premium-banner-ib-desc"> |
| 1069 | <?php if ( $settings['premium_banner_image_animation'] === 'animation7' || $settings['premium_banner_image_animation'] === 'animation8' ) : ?> |
| 1070 | <div class="premium-banner-border"> |
| 1071 | <div class="premium-banner-br premium-banner-bleft premium-banner-brlr "></div> |
| 1072 | <div class="premium-banner-br premium-banner-bright premium-banner-brlr "></div> |
| 1073 | <div class="premium-banner-br premium-banner-btop premium-banner-brtb "></div> |
| 1074 | <div class="premium-banner-br premium-banner-bottom premium-banner-brtb "></div> |
| 1075 | </div> |
| 1076 | |
| 1077 | <?php endif; ?> |
| 1078 | <div class="premium-banner-desc-centered"> |
| 1079 | <?php echo $full_title; |
| 1080 | if( ! empty( $settings['premium_banner_description'] ) ) : ?> |
| 1081 | <div class="premium-banner-ib-content premium_banner_content"> |
| 1082 | <div <?php echo $this->get_render_attribute_string('premium_banner_description'); ?>><?php echo $settings[ 'premium_banner_description' ]; ?></div> |
| 1083 | </div> |
| 1084 | <?php endif; ?> |
| 1085 | <?php |
| 1086 | if( 'yes' == $settings['premium_banner_link_switcher'] && !empty( $settings['premium_banner_more_text'] ) ) : ?> |
| 1087 | |
| 1088 | <div class ="premium-banner-read-more"> |
| 1089 | <a class = "premium-banner-link" <?php if( !empty( $banner_url ) ) : ?> href="<?php echo $banner_url; ?>"<?php endif;?><?php if( !empty( $settings['premium_banner_link']['is_external'] ) ) : ?> target="_blank" <?php endif; ?><?php if( !empty($settings['premium_banner_link']['nofollow'] ) ) : ?> rel="nofollow" <?php endif; ?>><?php echo esc_html( $settings['premium_banner_more_text'] ); ?></a> |
| 1090 | </div> |
| 1091 | |
| 1092 | <?php endif; ?> |
| 1093 | </div> |
| 1094 | </div> |
| 1095 | <?php |
| 1096 | if( $settings['premium_banner_link_url_switch'] === 'yes' && ( ! empty( $settings['premium_banner_image_custom_link']['url'] ) || !empty( $settings['premium_banner_image_existing_page_link'] ) ) ) { |
| 1097 | echo $full_link; |
| 1098 | } |
| 1099 | ?> |
| 1100 | </div> |
| 1101 | <?php if($settings['premium_banner_responsive_switcher'] == 'yes' ) : ?> |
| 1102 | <style> |
| 1103 | @media( min-width: <?php echo $min_size; ?> ) and (max-width:<?php echo $max_size; ?> ) { |
| 1104 | #premium-banner-<?php echo esc_attr( $this->get_id() ); ?> .premium-banner-ib-content { |
| 1105 | display: none; |
| 1106 | } |
| 1107 | } |
| 1108 | </style> |
| 1109 | <?php endif; ?> |
| 1110 | </div> |
| 1111 | <?php |
| 1112 | } |
| 1113 | |
| 1114 | /** |
| 1115 | * Render Banner widget output in the editor. |
| 1116 | * |
| 1117 | * Written as a Backbone JavaScript template and used to generate the live preview. |
| 1118 | * |
| 1119 | * @since 1.0.0 |
| 1120 | * @access protected |
| 1121 | */ |
| 1122 | protected function content_template() { |
| 1123 | ?> |
| 1124 | <# |
| 1125 | |
| 1126 | view.addRenderAttribute( 'banner', 'id', 'premium-banner-' + view.getID() ); |
| 1127 | view.addRenderAttribute( 'banner', 'class', 'premium-banner' ); |
| 1128 | |
| 1129 | if( 'true' === settings.mouse_tilt ) { |
| 1130 | view.addRenderAttribute( 'banner', 'data-box-tilt', 'true' ); |
| 1131 | if( 'true' === settings.mouse_tilt_rev ) { |
| 1132 | view.addRenderAttribute( 'banner', 'data-box-tilt-reverse', 'true' ); |
| 1133 | } |
| 1134 | } |
| 1135 | |
| 1136 | var active = 'yes' === settings.premium_banner_active ? 'active' : ''; |
| 1137 | |
| 1138 | view.addRenderAttribute( 'banner_inner', 'class', [ |
| 1139 | 'premium-banner-ib', |
| 1140 | 'premium-banner-min-height', |
| 1141 | 'premium-banner-' + settings.premium_banner_image_animation, |
| 1142 | settings.premium_banner_hover_effect, |
| 1143 | settings.premium_banner_extra_class, |
| 1144 | active |
| 1145 | ] ); |
| 1146 | |
| 1147 | var titleTag = settings.premium_banner_title_tag, |
| 1148 | title = settings.premium_banner_title; |
| 1149 | |
| 1150 | view.addRenderAttribute( 'premium_banner_title', 'class', [ |
| 1151 | 'premium-banner-ib-title', |
| 1152 | 'premium_banner_title' |
| 1153 | ] ); |
| 1154 | |
| 1155 | view.addInlineEditingAttributes( 'premium_banner_title' ); |
| 1156 | |
| 1157 | var description = settings.premium_banner_description; |
| 1158 | |
| 1159 | view.addInlineEditingAttributes( 'description', 'advanced' ); |
| 1160 | |
| 1161 | var linkSwitcher = settings.premium_banner_link_switcher, |
| 1162 | readMore = settings.premium_banner_more_text, |
| 1163 | bannerUrl = 'url' === settings.premium_banner_link_selection ? settings.premium_banner_link.url : settings.premium_banner_existing_link; |
| 1164 | |
| 1165 | var bannerLink = 'yes' === settings.premium_banner_image_link_switcher ? settings.premium_banner_image_custom_link.url : settings.premium_banner_image_existing_page_link, |
| 1166 | linkTitle = 'yes' === settings.premium_banner_link_url_switch ? settings.premium_banner_link_title : ''; |
| 1167 | |
| 1168 | var minSize = settings.premium_banner_min_range + 'px', |
| 1169 | maxSize = settings.premium_banner_max_range + 'px'; |
| 1170 | |
| 1171 | var imageHtml = ''; |
| 1172 | if ( settings.premium_banner_image.url ) { |
| 1173 | var image = { |
| 1174 | id: settings.premium_banner_image.id, |
| 1175 | url: settings.premium_banner_image.url, |
| 1176 | size: settings.thumbnail_size, |
| 1177 | dimension: settings.thumbnail_custom_dimension, |
| 1178 | model: view.getEditModel() |
| 1179 | }; |
| 1180 | |
| 1181 | var image_url = elementor.imagesManager.getImageUrl( image ); |
| 1182 | |
| 1183 | imageHtml = '<img src="' + image_url + '"/>'; |
| 1184 | |
| 1185 | } |
| 1186 | |
| 1187 | #> |
| 1188 | |
| 1189 | <div {{{ view.getRenderAttributeString( 'banner' ) }}}> |
| 1190 | <div {{{ view.getRenderAttributeString( 'banner_inner' ) }}}> |
| 1191 | <# if( '' !== settings.premium_banner_image.url ) { #> |
| 1192 | <# if( 'custom' === settings.premium_banner_height ) { #> |
| 1193 | <div class="premium-banner-img-wrap"> |
| 1194 | <# } #> |
| 1195 | {{{imageHtml}}} |
| 1196 | <# if( 'custom' === settings.premium_banner_height ) { #> |
| 1197 | </div> |
| 1198 | <# } #> |
| 1199 | <# } #> |
| 1200 | <div class="premium-banner-ib-desc"> |
| 1201 | <# if (settings.premium_banner_image_animation ==='animation7' || settings.premium_banner_image_animation ==='animation8'){ #> |
| 1202 | <div class="premium-banner-border"> |
| 1203 | <div class="premium-banner-br premium-banner-bleft premium-banner-brlr"></div> |
| 1204 | <div class="premium-banner-br premium-banner-bright premium-banner-brlr"></div> |
| 1205 | <div class="premium-banner-br premium-banner-btop premium-banner-brtb"></div> |
| 1206 | <div class="premium-banner-br premium-banner-bottom premium-banner-brtb"></div> |
| 1207 | </div> |
| 1208 | <# } #> |
| 1209 | <div class="premium-banner-desc-centered"> |
| 1210 | <# if( '' !== title ) { #> |
| 1211 | <div class="premium-banner-title-wrap"> |
| 1212 | <{{{titleTag}}} {{{ view.getRenderAttributeString('premium_banner_title') }}}>{{{ title }}}</{{{titleTag}}}> |
| 1213 | </div> |
| 1214 | <# } #> |
| 1215 | <# if( '' !== description ) { #> |
| 1216 | <div class="premium-banner-ib-content premium_banner_content"> |
| 1217 | <div {{{ view.getRenderAttributeString( 'description' ) }}}>{{{ description }}}</div> |
| 1218 | </div> |
| 1219 | <# } #> |
| 1220 | <# if( 'yes' === linkSwitcher && '' !== readMore ) { #> |
| 1221 | <div class ="premium-banner-read-more"> |
| 1222 | <a class = "premium-banner-link" href="{{ bannerUrl }}">{{{ readMore }}}</a> |
| 1223 | </div> |
| 1224 | <# } #> |
| 1225 | </div> |
| 1226 | </div> |
| 1227 | <# if( 'yes' === settings.premium_banner_link_url_switch && ( '' !== settings.premium_banner_image_custom_link.url || '' !== settings.premium_banner_image_existing_page_link ) ) { #> |
| 1228 | <a class="premium-banner-ib-link" href="{{ bannerLink }}" title="{{ linkTitle }}"></a> |
| 1229 | <# } #> |
| 1230 | </div> |
| 1231 | <# if( 'yes' === settings.premium_banner_responsive_switcher ) { #> |
| 1232 | <style> |
| 1233 | @media( min-width: {{minSize}} ) and ( max-width: {{maxSize}} ) { |
| 1234 | #premium-banner-{{ view.getID() }} .premium-banner-ib-content { |
| 1235 | display: none; |
| 1236 | } |
| 1237 | } |
| 1238 | </style> |
| 1239 | <# } #> |
| 1240 | </div> |
| 1241 | |
| 1242 | |
| 1243 | <?php |
| 1244 | } |
| 1245 | } |