premium-banner.php
7 years ago
premium-blog.php
7 years ago
premium-button.php
7 years ago
premium-carousel.php
7 years ago
premium-contactform.php
7 years ago
premium-countdown.php
7 years ago
premium-counter.php
7 years ago
premium-dual-header.php
7 years ago
premium-fancytext.php
7 years ago
premium-grid.php
7 years ago
premium-image-button.php
7 years ago
premium-imageseparator.php
7 years ago
premium-maps.php
7 years ago
premium-modalbox.php
7 years ago
premium-person.php
7 years ago
premium-pricing-table.php
7 years ago
premium-progressbar.php
7 years ago
premium-testimonials.php
7 years ago
premium-title.php
7 years ago
premium-videobox.php
7 years ago
premium-banner.php
812 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort. |
| 5 | |
| 6 | class Premium_Banner_Widget extends Widget_Base { |
| 7 | |
| 8 | protected $templateInstance; |
| 9 | |
| 10 | public function getTemplateInstance() { |
| 11 | return $this->templateInstance = premium_Template_Tags::getInstance(); |
| 12 | } |
| 13 | |
| 14 | public function get_name() { |
| 15 | return 'premium-addon-banner'; |
| 16 | } |
| 17 | |
| 18 | public function get_title() { |
| 19 | return \PremiumAddons\Helper_Functions::get_prefix() . ' Banner'; |
| 20 | } |
| 21 | |
| 22 | public function get_icon() { |
| 23 | return 'pa-banner'; |
| 24 | } |
| 25 | |
| 26 | public function get_categories() { |
| 27 | return [ 'premium-elements' ]; |
| 28 | } |
| 29 | |
| 30 | public function get_script_depends() |
| 31 | { |
| 32 | return ['premium-addons-js']; |
| 33 | } |
| 34 | |
| 35 | // Adding the controls fields for the premium banner |
| 36 | // This will controls the animation, colors and background, dimensions etc |
| 37 | protected function _register_controls() { |
| 38 | |
| 39 | $this->start_controls_section( |
| 40 | 'premium_banner_global_settings', |
| 41 | [ |
| 42 | 'label' => esc_html__( 'Image', 'premium-addons-for-elementor' ) |
| 43 | ] |
| 44 | ); |
| 45 | |
| 46 | $this->add_control( |
| 47 | 'premium_banner_image', |
| 48 | [ |
| 49 | 'label' => esc_html__( 'Upload Image', 'premium-addons-for-elementor' ), |
| 50 | 'description' => esc_html__( 'Select an image for the Banner', 'premium-addons-for-elementor' ), |
| 51 | 'type' => Controls_Manager::MEDIA, |
| 52 | 'default' => [ |
| 53 | 'url' => Utils::get_placeholder_image_src() |
| 54 | ], |
| 55 | 'show_external' => true |
| 56 | ] |
| 57 | ); |
| 58 | |
| 59 | $this->add_control('premium_banner_link_url_switch', |
| 60 | [ |
| 61 | 'label' => esc_html__('Link', 'premium-addons-for-elementor'), |
| 62 | 'type' => Controls_Manager::SWITCHER, |
| 63 | ] |
| 64 | ); |
| 65 | |
| 66 | $this->add_control( |
| 67 | 'premium_banner_image_link_switcher', |
| 68 | [ |
| 69 | 'label' => esc_html__( 'Custom Link', 'premium-addons-for-elementor' ), |
| 70 | 'type' => Controls_Manager::SWITCHER, |
| 71 | 'default' => '', |
| 72 | 'description' => esc_html__( 'Add a custom link to the banner', 'premium-addons-for-elementor' ), |
| 73 | 'condition' => [ |
| 74 | 'premium_banner_link_url_switch' => 'yes', |
| 75 | ], |
| 76 | ] |
| 77 | ); |
| 78 | |
| 79 | $this->add_control( |
| 80 | 'premium_banner_image_custom_link', |
| 81 | [ |
| 82 | 'label' => esc_html__( 'Set custom Link', 'premium-addons-for-elementor' ), |
| 83 | 'type' => Controls_Manager::URL, |
| 84 | 'description' => esc_html__( 'What custom link you want to set to banner?', 'premium-addons-for-elementor' ), |
| 85 | 'condition' => [ |
| 86 | 'premium_banner_image_link_switcher' => 'yes', |
| 87 | 'premium_banner_link_url_switch' => 'yes', |
| 88 | ], |
| 89 | 'show_external' => false, |
| 90 | ] |
| 91 | ); |
| 92 | |
| 93 | $this->add_control( |
| 94 | 'premium_banner_image_existing_page_link', |
| 95 | [ |
| 96 | 'label' => esc_html__( 'Existing Page', 'premium-addons-for-elementor' ), |
| 97 | 'type' => Controls_Manager::SELECT2, |
| 98 | 'description' => esc_html__( 'Link the banner with an existing page', 'premium-addons-for-elementor' ), |
| 99 | 'condition' => [ |
| 100 | 'premium_banner_image_link_switcher!' => 'yes', |
| 101 | 'premium_banner_link_url_switch' => 'yes', |
| 102 | ], |
| 103 | 'multiple' => false, |
| 104 | 'options' => $this->getTemplateInstance()->get_all_post() |
| 105 | ] |
| 106 | ); |
| 107 | |
| 108 | $this->add_control( |
| 109 | 'premium_banner_image_link_open_new_tab', |
| 110 | [ |
| 111 | 'label' => esc_html__( 'New Tab', 'premium-addons-for-elementor' ), |
| 112 | 'type' => Controls_Manager::SWITCHER, |
| 113 | 'default' => '', |
| 114 | 'description' => esc_html__( 'Choose if you want the link be opened in a new tab or not', 'premium-addons-for-elementor' ), |
| 115 | 'condition' => [ |
| 116 | 'premium_banner_link_url_switch' => 'yes', |
| 117 | ], |
| 118 | ] |
| 119 | ); |
| 120 | |
| 121 | $this->add_control( |
| 122 | 'premium_banner_image_link_add_nofollow', |
| 123 | [ |
| 124 | 'label' => esc_html__( 'Nofollow Option', 'premium-addons-for-elementor' ), |
| 125 | 'type' => Controls_Manager::SWITCHER, |
| 126 | 'default' => '', |
| 127 | 'description' => esc_html__('if you choose yes, the link will not be counted in search engines', 'premium-addons-for-elementor' ), |
| 128 | 'condition' => [ |
| 129 | 'premium_banner_link_url_switch' => 'yes', |
| 130 | ], |
| 131 | ] |
| 132 | ); |
| 133 | |
| 134 | $this->add_control( |
| 135 | 'premium_banner_image_animation', |
| 136 | [ |
| 137 | 'label' => esc_html__( 'Effect', 'premium-addons-for-elementor' ), |
| 138 | 'type' => Controls_Manager::SELECT, |
| 139 | 'default' => 'premium_banner_animation1', |
| 140 | 'description' => esc_html__( 'Choose a hover effect for the banner', 'premium-addons-for-elementor' ), |
| 141 | 'options' => [ |
| 142 | 'premium_banner_animation1' => 'Effect 1', |
| 143 | 'premium_banner_animation5' => 'Effect 2', |
| 144 | 'premium_banner_animation13' => 'Effect 3', |
| 145 | 'premium_banner_animation2' => 'Effect 4', |
| 146 | 'premium_banner_animation4' => 'Effect 5', |
| 147 | 'premium_banner_animation6' => 'Effect 6' |
| 148 | ] |
| 149 | ] |
| 150 | ); |
| 151 | |
| 152 | $this->add_control( |
| 153 | 'premium_banner_active', |
| 154 | [ |
| 155 | 'label' => esc_html__( 'Always Hovered', 'premium-addons-for-elementor' ), |
| 156 | 'type' => Controls_Manager::SWITCHER, |
| 157 | 'description' => esc_html__( 'Choose if you want the effect to be always triggered', 'premium-addons-for-elementor' ), |
| 158 | |
| 159 | ] |
| 160 | ); |
| 161 | |
| 162 | $this->add_control( |
| 163 | 'premium_banner_hover_effect', |
| 164 | [ |
| 165 | 'label' => esc_html__('Hover Effect', 'premium-addons-for-elementor'), |
| 166 | 'type' => Controls_Manager::SELECT, |
| 167 | 'options' => [ |
| 168 | 'none' => esc_html__('None', 'premium-addons-for-elementor'), |
| 169 | 'zoomin' => esc_html__('Zoom In', 'premium-addons-for-elementor'), |
| 170 | 'zoomout' => esc_html__('Zoom Out', 'premium-addons-for-elementor'), |
| 171 | 'scale' => esc_html__('Scale', 'premium-addons-for-elementor'), |
| 172 | 'grayscale' => esc_html__('Grayscale', 'premium-addons-for-elementor'), |
| 173 | 'blur' => esc_html__('Blur', 'premium-addons-for-elementor'), |
| 174 | 'bright' => esc_html__('Bright', 'premium-addons-for-elementor'), |
| 175 | 'sepia' => esc_html__('Sepia', 'premium-addons-for-elementor'), |
| 176 | ], |
| 177 | 'default' => 'none', |
| 178 | ] |
| 179 | ); |
| 180 | |
| 181 | $this->add_control( |
| 182 | 'premium_banner_height', |
| 183 | [ |
| 184 | 'label' => esc_html__( 'Height', 'premium-addons-for-elementor' ), |
| 185 | 'type' => Controls_Manager::SELECT, |
| 186 | 'options' => [ |
| 187 | 'default' => 'Default', |
| 188 | 'custom' => 'Custom', |
| 189 | ], |
| 190 | 'default' => 'default', |
| 191 | 'description' => esc_html__( 'Choose if you want to set a custom height for the banner or keep it as it is', 'premium-addons-for-elementor' ), |
| 192 | |
| 193 | ] |
| 194 | ); |
| 195 | |
| 196 | $this->add_responsive_control( |
| 197 | 'premium_banner_custom_height', |
| 198 | [ |
| 199 | 'label' => esc_html__( 'Min Height', 'premium-addons-for-elementor' ), |
| 200 | 'type' => Controls_Manager::NUMBER, |
| 201 | 'description' => esc_html__( 'Set a minimum height value in pixels', 'premium-addons-for-elementor' ), |
| 202 | 'condition' => [ |
| 203 | 'premium_banner_height' => 'custom' |
| 204 | ], |
| 205 | 'selectors' => [ |
| 206 | '{{WRAPPER}} .premium_addons-banner-ib' => 'height: {{VALUE}}px;' |
| 207 | ] |
| 208 | ] |
| 209 | ); |
| 210 | |
| 211 | $this->add_responsive_control( |
| 212 | 'premium_banner_img_vertical_align', |
| 213 | [ |
| 214 | 'label' => esc_html__( 'Vertical Align', 'premium-addons-for-elementor' ), |
| 215 | 'type' => Controls_Manager::SELECT, |
| 216 | 'condition' => [ |
| 217 | 'premium_banner_height' => 'custom' |
| 218 | ], |
| 219 | 'options' => [ |
| 220 | 'flex-start' => esc_html__('Top', 'premium-addons-for-elementor'), |
| 221 | 'center' => esc_html__('Middle', 'premium-addons-for-elementor'), |
| 222 | 'flex-end' => esc_html__('Bottom', 'premium-addons-for-elementor'), |
| 223 | 'inherit' => esc_html__('Full', 'premium-addons-for-elementor'), |
| 224 | ], |
| 225 | 'default' => 'flex-start', |
| 226 | 'selectors' => [ |
| 227 | '{{WRAPPER}} .premium_addons-banner-img-wrap' => 'align-items: {{VALUE}}; -webkit-align-items: {{VALUE}};' |
| 228 | ] |
| 229 | ] |
| 230 | ); |
| 231 | |
| 232 | $this->add_control( |
| 233 | 'premium_banner_extra_class', |
| 234 | [ |
| 235 | 'label' => esc_html__( 'Extra Class', 'premium-addons-for-elementor' ), |
| 236 | 'type' => Controls_Manager::TEXT, |
| 237 | 'description' => esc_html__( 'Add extra class name that will be applied to the banner, and you can use this class for your customizations.', 'premium-addons-for-elementor' ), |
| 238 | ] |
| 239 | ); |
| 240 | |
| 241 | |
| 242 | $this->end_controls_section(); |
| 243 | |
| 244 | $this->start_controls_section( |
| 245 | 'premium_banner_image_section', |
| 246 | [ |
| 247 | 'label' => esc_html__( 'Content', 'premium-addons-for-elementor' ) |
| 248 | ] |
| 249 | ); |
| 250 | |
| 251 | $this->add_control( |
| 252 | 'premium_banner_title', |
| 253 | [ |
| 254 | 'label' => esc_html__( 'Title', 'premium-addons-for-elementor' ), |
| 255 | 'placeholder' => esc_html__( 'Give a title to this banner', 'premium-addons-for-elementor' ), |
| 256 | 'description' => esc_html__( 'Give a title to this banner', 'premium-addons-for-elementor' ), |
| 257 | 'type' => Controls_Manager::TEXT, |
| 258 | 'dynamic' => [ 'active' => true ], |
| 259 | 'default' => esc_html__( 'Premium Banner', 'premium-addons-for-elementor' ), |
| 260 | 'label_block' => false |
| 261 | ] |
| 262 | ); |
| 263 | |
| 264 | $this->add_control( |
| 265 | 'premium_banner_title_tag', |
| 266 | [ |
| 267 | 'label' => esc_html__( 'HTML Tag', 'premium-addons-for-elementor' ), |
| 268 | 'description' => esc_html__( 'Select a heading tag for the title. Headings are defined with H1 to H6 tags', 'premium-addons-for-elementor' ), |
| 269 | 'type' => Controls_Manager::SELECT, |
| 270 | 'default' => 'h3', |
| 271 | 'options' => [ |
| 272 | 'h1' => 'H1', |
| 273 | 'h2' => 'H2', |
| 274 | 'h3' => 'H3', |
| 275 | 'h4' => 'H4', |
| 276 | 'h5' => 'H5', |
| 277 | 'h6' => 'H6', |
| 278 | ], |
| 279 | 'label_block' => true, |
| 280 | ] |
| 281 | ); |
| 282 | |
| 283 | |
| 284 | $this->add_control( |
| 285 | 'premium_banner_description_hint', |
| 286 | [ |
| 287 | 'label' => esc_html__( 'Description', 'premium-addons-for-elementor' ), |
| 288 | 'type' => Controls_Manager::HEADING, |
| 289 | ] |
| 290 | ); |
| 291 | |
| 292 | $this->add_control( |
| 293 | 'premium_banner_description', |
| 294 | [ |
| 295 | 'label' => esc_html__( 'Description', 'premium-addons-for-elementor' ), |
| 296 | 'description' => esc_html__( 'Give the description to this banner', 'premium-addons-for-elementor' ), |
| 297 | 'type' => Controls_Manager::WYSIWYG, |
| 298 | 'dynamic' => [ 'active' => true ], |
| 299 | 'default' => esc_html__( 'Premium Banner gives you a wide range of styles and options that you will definitely fall in love with', 'premium-addons-for-elementor' ), |
| 300 | 'label_block' => true |
| 301 | ] |
| 302 | ); |
| 303 | |
| 304 | $this->add_control( |
| 305 | 'premium_banner_link_switcher', |
| 306 | [ |
| 307 | 'label' => esc_html__('Button', 'premium-addons-for-elementor'), |
| 308 | 'type' => Controls_Manager::SWITCHER, |
| 309 | 'condition' => [ |
| 310 | 'premium_banner_link_url_switch!' => 'yes' |
| 311 | ] |
| 312 | ] |
| 313 | ); |
| 314 | |
| 315 | |
| 316 | $this->add_control( |
| 317 | 'premium_banner_more_text', |
| 318 | [ |
| 319 | 'label' => esc_html__('Text','premium-addons-for-elementor'), |
| 320 | 'type' => Controls_Manager::TEXT, |
| 321 | 'dynamic' => [ 'active' => true ], |
| 322 | 'default' => 'Click Here', |
| 323 | 'condition' => [ |
| 324 | 'premium_banner_link_switcher' => 'yes', |
| 325 | 'premium_banner_link_url_switch!' => 'yes' |
| 326 | ] |
| 327 | ] |
| 328 | ); |
| 329 | |
| 330 | $this->add_control( |
| 331 | 'premium_banner_link_selection', |
| 332 | [ |
| 333 | 'label' => esc_html__('Link Type', 'premium-addons-for-elementor'), |
| 334 | 'type' => Controls_Manager::SELECT, |
| 335 | 'options' => [ |
| 336 | 'url' => esc_html__('URL', 'premium-addons-for-elementor'), |
| 337 | 'link' => esc_html__('Existing Page', 'premium-addons-for-elementor'), |
| 338 | ], |
| 339 | 'default' => 'url', |
| 340 | 'label_block' => true, |
| 341 | 'condition' => [ |
| 342 | 'premium_banner_link_switcher' => 'yes', |
| 343 | 'premium_banner_link_url_switch!' => 'yes' |
| 344 | ] |
| 345 | ] |
| 346 | ); |
| 347 | |
| 348 | $this->add_control( |
| 349 | 'premium_banner_link', |
| 350 | [ |
| 351 | 'label' => esc_html__('Link', 'premium-addons-for-elementor'), |
| 352 | 'type' => Controls_Manager::URL, |
| 353 | 'default' => [ |
| 354 | 'url' => '#', |
| 355 | ], |
| 356 | 'placeholder' => 'https://premiumaddons.com/', |
| 357 | 'label_block' => true, |
| 358 | 'condition' => [ |
| 359 | 'premium_banner_link_selection' => 'url', |
| 360 | 'premium_banner_link_switcher' => 'yes', |
| 361 | 'premium_banner_link_url_switch!' => 'yes' |
| 362 | ] |
| 363 | ] |
| 364 | ); |
| 365 | |
| 366 | $this->add_control( |
| 367 | 'premium_banner_existing_link', |
| 368 | [ |
| 369 | 'label' => esc_html__('Existing Page', 'premium-addons-for-elementor'), |
| 370 | 'type' => Controls_Manager::SELECT2, |
| 371 | 'options' => $this->getTemplateInstance()->get_all_post(), |
| 372 | 'multiple' => false, |
| 373 | 'condition' => [ |
| 374 | 'premium_banner_link_selection' => 'link', |
| 375 | 'premium_banner_link_switcher' => 'yes', |
| 376 | 'premium_banner_link_url_switch!' => 'yes' |
| 377 | ], |
| 378 | 'label_block' => true, |
| 379 | ] |
| 380 | ); |
| 381 | |
| 382 | |
| 383 | $this->add_control('premium_banner_title_text_align', |
| 384 | [ |
| 385 | 'label' => esc_html__('Alignment', 'premium-addons-for-elementor'), |
| 386 | 'type' => Controls_Manager::CHOOSE, |
| 387 | 'options' => [ |
| 388 | 'left' => [ |
| 389 | 'title' => esc_html__('Left', 'premium-addons-for-elementor'), |
| 390 | 'icon' => 'fa fa-align-left' |
| 391 | ], |
| 392 | 'center' => [ |
| 393 | 'title' => esc_html__('Center', 'premium-addons-for-elementor'), |
| 394 | 'icon' => 'fa fa-align-center' |
| 395 | ], |
| 396 | 'right' => [ |
| 397 | 'title' => esc_html__('Right', 'premium-addons-for-elementor'), |
| 398 | 'icon' => 'fa fa-align-right' |
| 399 | ], |
| 400 | ], |
| 401 | 'default' => 'left', |
| 402 | 'toggle' => false, |
| 403 | 'selectors' => [ |
| 404 | '{{WRAPPER}} .premium_addons-banner-ib-title, {{WRAPPER}} .premium_addons-banner-ib-content, {{WRAPPER}} .premium-banner-read-more' => 'text-align: {{VALUE}};', |
| 405 | ] |
| 406 | ] |
| 407 | ); |
| 408 | |
| 409 | $this->end_controls_section(); |
| 410 | |
| 411 | $this->start_controls_section('premium_banner_responsive_section', |
| 412 | [ |
| 413 | 'label' => esc_html__('Responsive', 'premium-addons-for-elementor'), |
| 414 | ]); |
| 415 | |
| 416 | $this->add_control('premium_banner_responsive_switcher', |
| 417 | [ |
| 418 | 'label' => esc_html__('Responsive Controls', 'premium-addons-for-elementor'), |
| 419 | 'type' => Controls_Manager::SWITCHER, |
| 420 | 'description' => esc_html__('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') |
| 421 | ]); |
| 422 | |
| 423 | $this->add_control('premium_banner_min_range', |
| 424 | [ |
| 425 | 'label' => esc_html__('Minimum Size', 'premium-addons-for-elementor'), |
| 426 | 'type' => Controls_Manager::NUMBER, |
| 427 | 'description'=> esc_html__('Note: minimum size for extra small screens is 1px.','premium-addons-for-elementor'), |
| 428 | 'default' => 1, |
| 429 | 'condition' => [ |
| 430 | 'premium_banner_responsive_switcher' => 'yes' |
| 431 | ], |
| 432 | ]); |
| 433 | |
| 434 | $this->add_control('premium_banner_max_range', |
| 435 | [ |
| 436 | 'label' => esc_html__('Maximum Size', 'premium-addons-for-elementor'), |
| 437 | 'type' => Controls_Manager::NUMBER, |
| 438 | 'description'=> esc_html__('Note: maximum size for extra small screens is 767px.','premium-addons-for-elementor'), |
| 439 | 'default' => 767, |
| 440 | 'condition' => [ |
| 441 | 'premium_banner_responsive_switcher' => 'yes' |
| 442 | ], |
| 443 | ]); |
| 444 | |
| 445 | $this->end_controls_section(); |
| 446 | |
| 447 | $this->start_controls_section( |
| 448 | 'premium_banner_opacity_style', |
| 449 | [ |
| 450 | 'label' => esc_html__( 'Image', 'premium-addons-for-elementor' ), |
| 451 | 'tab' => Controls_Manager::TAB_STYLE |
| 452 | ] |
| 453 | ); |
| 454 | |
| 455 | $this->add_control( |
| 456 | 'premium_banner_image_bg_color', |
| 457 | [ |
| 458 | 'label' => esc_html__( 'Background Color', 'premium-addons-for-elementor' ), |
| 459 | 'type' => Controls_Manager::COLOR, |
| 460 | 'selectors' => [ |
| 461 | '{{WRAPPER}} .premium_addons-banner-ib' => 'background: {{VALUE}};', |
| 462 | ] |
| 463 | ] |
| 464 | ); |
| 465 | |
| 466 | $this->add_control( |
| 467 | 'premium_banner_image_opacity', |
| 468 | [ |
| 469 | 'label' => esc_html__( 'Image Opacity', 'premium-addons-for-elementor' ), |
| 470 | 'type' => Controls_Manager::SLIDER, |
| 471 | 'default' => [ |
| 472 | 'size' => 1, |
| 473 | ], |
| 474 | 'range' => [ |
| 475 | 'px' => [ |
| 476 | 'min' => 0, |
| 477 | 'max' => 1, |
| 478 | 'step' => .1, |
| 479 | ] |
| 480 | ], |
| 481 | 'selectors' => [ |
| 482 | '{{WRAPPER}} .premium_addons-banner-ib .premium_addons-banner-ib-img' => 'opacity: {{SIZE}};', |
| 483 | ], |
| 484 | ] |
| 485 | ); |
| 486 | |
| 487 | |
| 488 | $this->add_control( |
| 489 | 'premium_banner_image_hover_opacity', |
| 490 | [ |
| 491 | 'label' => esc_html__( 'Hover Opacity', 'premium-addons-for-elementor' ), |
| 492 | 'type' => Controls_Manager::SLIDER, |
| 493 | 'default' => [ |
| 494 | 'size' => 1, |
| 495 | ], |
| 496 | 'range' => [ |
| 497 | 'px' => [ |
| 498 | 'min' => 0, |
| 499 | 'max' => 1, |
| 500 | 'step' => .1, |
| 501 | ] |
| 502 | ], |
| 503 | 'selectors' => [ |
| 504 | '{{WRAPPER}} .premium_addons-banner-ib .premium_addons-banner-ib-img.active' => 'opacity: {{SIZE}};', |
| 505 | ], |
| 506 | ] |
| 507 | ); |
| 508 | |
| 509 | $this->end_controls_section(); |
| 510 | |
| 511 | $this->start_controls_section( |
| 512 | 'premium_banner_title_style', |
| 513 | [ |
| 514 | 'label' => esc_html__( 'Title', 'premium-addons-for-elementor' ), |
| 515 | 'tab' => Controls_Manager::TAB_STYLE |
| 516 | ] |
| 517 | ); |
| 518 | |
| 519 | $this->add_control( |
| 520 | 'premium_banner_color_of_title', |
| 521 | [ |
| 522 | 'label' => esc_html__( 'Color', 'premium-addons-for-elementor' ), |
| 523 | 'type' => Controls_Manager::COLOR, |
| 524 | 'scheme' => [ |
| 525 | 'type' => Scheme_Color::get_type(), |
| 526 | 'value' => Scheme_Color::COLOR_1, |
| 527 | ], |
| 528 | 'selectors' => [ |
| 529 | '{{WRAPPER}} .premium_addons-banner-ib-desc .premium_banner_title' => 'color: {{VALUE}};' |
| 530 | ], |
| 531 | ] |
| 532 | ); |
| 533 | |
| 534 | $this->add_control( |
| 535 | 'premium_banner_style2_title_bg', |
| 536 | [ |
| 537 | 'label' => esc_html__( 'Title Background', 'premium-addons-for-elementor' ), |
| 538 | 'type' => Controls_Manager::COLOR, |
| 539 | 'default' => '#f2f2f2', |
| 540 | 'description' => esc_html__( 'Choose a background color for the title', 'premium-addons-for-elementor' ), |
| 541 | 'condition' => [ |
| 542 | 'premium_banner_image_animation' => 'premium_banner_animation5' |
| 543 | ], |
| 544 | 'selectors' => [ |
| 545 | '{{WRAPPER}} .premium_banner_animation5 .premium_addons-banner-ib-desc' => 'background: {{VALUE}};', |
| 546 | ], |
| 547 | ] |
| 548 | ); |
| 549 | |
| 550 | $this->add_group_control( |
| 551 | Group_Control_Typography::get_type(), |
| 552 | [ |
| 553 | 'name' => 'premium_banner_title_typography', |
| 554 | 'selector' => '{{WRAPPER}} .premium_addons-banner-ib-desc .premium_banner_title', |
| 555 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 556 | ] |
| 557 | ); |
| 558 | |
| 559 | $this->add_group_control( |
| 560 | Group_Control_Text_Shadow::get_type(), |
| 561 | [ |
| 562 | 'label' => esc_html__('Shadow','premium-addons-for-elementor'), |
| 563 | 'name' => 'premium_banner_title_shadow', |
| 564 | 'selector' => '{{WRAPPER}} .premium_addons-banner-ib-desc .premium_banner_title', |
| 565 | ] |
| 566 | ); |
| 567 | |
| 568 | $this->end_controls_section(); |
| 569 | |
| 570 | $this->start_controls_section( |
| 571 | 'premium_banner_styles_of_content', |
| 572 | [ |
| 573 | 'label' => esc_html__( 'Description', 'premium-addons-for-elementor' ), |
| 574 | 'tab' => Controls_Manager::TAB_STYLE |
| 575 | ] |
| 576 | ); |
| 577 | |
| 578 | $this->add_control( |
| 579 | 'premium_banner_color_of_content', |
| 580 | [ |
| 581 | 'label' => esc_html__( 'Color', 'premium-addons-for-elementor' ), |
| 582 | 'type' => Controls_Manager::COLOR, |
| 583 | 'scheme' => [ |
| 584 | 'type' => Scheme_Color::get_type(), |
| 585 | 'value' => Scheme_Color::COLOR_3, |
| 586 | ], |
| 587 | 'selectors' => [ |
| 588 | '{{WRAPPER}} .premium_banner .premium_banner_content' => 'color: {{VALUE}};' |
| 589 | ], |
| 590 | ] |
| 591 | ); |
| 592 | |
| 593 | $this->add_group_control( |
| 594 | Group_Control_Typography::get_type(), |
| 595 | [ |
| 596 | 'name' => 'premium_banner_content_typhography', |
| 597 | 'selector' => '{{WRAPPER}} .premium_banner .premium_banner_content', |
| 598 | 'scheme' => Scheme_Typography::TYPOGRAPHY_3, |
| 599 | ] |
| 600 | ); |
| 601 | |
| 602 | $this->add_group_control( |
| 603 | Group_Control_Text_Shadow::get_type(), |
| 604 | [ |
| 605 | 'label' => esc_html__('Shadow','premium-addons-for-elementor'), |
| 606 | 'name' => 'premium_banner_description_shadow', |
| 607 | 'selector' => '{{WRAPPER}} .premium_banner .premium_banner_content', |
| 608 | ] |
| 609 | ); |
| 610 | |
| 611 | $this->end_controls_section(); |
| 612 | |
| 613 | $this->start_controls_section( |
| 614 | 'premium_banner_styles_of_button', |
| 615 | [ |
| 616 | 'label' => esc_html__( 'Button', 'premium-addons-for-elementor' ), |
| 617 | 'tab' => Controls_Manager::TAB_STYLE, |
| 618 | 'condition' => [ |
| 619 | 'premium_banner_link_switcher' => 'yes', |
| 620 | 'premium_banner_link_url_switch!' => 'yes' |
| 621 | ] |
| 622 | ] |
| 623 | ); |
| 624 | |
| 625 | $this->add_control( |
| 626 | 'premium_banner_color_of_button', |
| 627 | [ |
| 628 | 'label' => esc_html__( 'Color', 'premium-addons-for-elementor' ), |
| 629 | 'type' => Controls_Manager::COLOR, |
| 630 | 'scheme' => [ |
| 631 | 'type' => Scheme_Color::get_type(), |
| 632 | 'value' => Scheme_Color::COLOR_3, |
| 633 | ], |
| 634 | 'selectors' => [ |
| 635 | '{{WRAPPER}} .premium_banner .premium-banner-link' => 'color: {{VALUE}};' |
| 636 | ], |
| 637 | ] |
| 638 | ); |
| 639 | |
| 640 | $this->add_control( |
| 641 | 'premium_banner_hover_color_of_button', |
| 642 | [ |
| 643 | 'label' => esc_html__( 'Hover Color', 'premium-addons-for-elementor' ), |
| 644 | 'type' => Controls_Manager::COLOR, |
| 645 | 'scheme' => [ |
| 646 | 'type' => Scheme_Color::get_type(), |
| 647 | 'value' => Scheme_Color::COLOR_3, |
| 648 | ], |
| 649 | 'selectors' => [ |
| 650 | '{{WRAPPER}} .premium_banner .premium-banner-link:hover' => 'color: {{VALUE}};' |
| 651 | ], |
| 652 | ] |
| 653 | ); |
| 654 | |
| 655 | $this->add_group_control( |
| 656 | Group_Control_Typography::get_type(), |
| 657 | [ |
| 658 | 'name' => 'premium_banner_button_typhography', |
| 659 | 'scheme' => Scheme_Typography::TYPOGRAPHY_3, |
| 660 | 'selector' => '{{WRAPPER}} .premium_banner .premium-banner-link', |
| 661 | ] |
| 662 | ); |
| 663 | |
| 664 | $this->add_control( |
| 665 | 'premium_banner_backcolor_of_button', |
| 666 | [ |
| 667 | 'label' => esc_html__( 'Background Color', 'premium-addons-for-elementor' ), |
| 668 | 'type' => Controls_Manager::COLOR, |
| 669 | 'selectors' => [ |
| 670 | '{{WRAPPER}} .premium_banner .premium-banner-link' => 'background-color: {{VALUE}};' |
| 671 | ], |
| 672 | ] |
| 673 | ); |
| 674 | |
| 675 | $this->add_control( |
| 676 | 'premium_banner_hover_backcolor_of_buttin', |
| 677 | [ |
| 678 | 'label' => esc_html__( 'Hover Background Color', 'premium-addons-for-elementor' ), |
| 679 | 'type' => Controls_Manager::COLOR, |
| 680 | 'selectors' => [ |
| 681 | '{{WRAPPER}} .premium_banner .premium-banner-link:hover' => 'background-color: {{VALUE}};' |
| 682 | ], |
| 683 | ] |
| 684 | ); |
| 685 | |
| 686 | $this->add_group_control( |
| 687 | Group_Control_Border::get_type(), |
| 688 | [ |
| 689 | 'name' => 'premium_banner_button_border', |
| 690 | 'selector' => '{{WRAPPER}} .premium_banner .premium-banner-link', |
| 691 | ] |
| 692 | ); |
| 693 | |
| 694 | $this->add_control('premium_banner_button_border_radius', |
| 695 | [ |
| 696 | 'label' => esc_html__('Border Radius', 'premium-addons-for-elementor'), |
| 697 | 'type' => Controls_Manager::SLIDER, |
| 698 | 'size_units' => ['px', '%' ,'em'], |
| 699 | 'selectors' => [ |
| 700 | '{{WRAPPER}} .premium_banner .premium-banner-link' => 'border-radius: {{SIZE}}{{UNIT}};' |
| 701 | ] |
| 702 | ] |
| 703 | ); |
| 704 | |
| 705 | $this->add_group_control( |
| 706 | Group_Control_Text_Shadow::get_type(), |
| 707 | [ |
| 708 | 'label' => esc_html__('Shadow','premium-addons-for-elementor'), |
| 709 | 'name' => 'premium_banner_button_shadow', |
| 710 | 'selector' => '{{WRAPPER}} .premium_banner .premium-banner-link', |
| 711 | ] |
| 712 | ); |
| 713 | |
| 714 | $this->add_responsive_control('premium_banner_button_padding', |
| 715 | [ |
| 716 | 'label' => esc_html__('Padding', 'premium-addons-for-elementor'), |
| 717 | 'type' => Controls_Manager::DIMENSIONS, |
| 718 | 'size_units' => ['px', 'em', '%'], |
| 719 | 'selectors' => [ |
| 720 | '{{WRAPPER}} .premium_banner .premium-banner-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 721 | ] |
| 722 | ]); |
| 723 | |
| 724 | $this->end_controls_section(); |
| 725 | |
| 726 | } |
| 727 | |
| 728 | |
| 729 | protected function render() { |
| 730 | $settings = $this->get_settings_for_display(); // All the settings values stored in $settings varaiable |
| 731 | $this->add_inline_editing_attributes('premium_banner_title'); |
| 732 | $this->add_inline_editing_attributes('premium_banner_description', 'advanced'); |
| 733 | |
| 734 | $title_tag = $settings[ 'premium_banner_title_tag' ]; |
| 735 | $title = $settings[ 'premium_banner_title' ]; |
| 736 | $full_title = '<'. $title_tag . ' class="premium_addons-banner-ib-title ult-responsive premium_banner_title"><div '. $this->get_render_attribute_string('premium_banner_title') .'>' .$title. '</div></'.$title_tag.'>'; |
| 737 | |
| 738 | $link = isset( $settings['premium_banner_image_link_switcher'] ) && $settings['premium_banner_image_link_switcher'] != '' ? $settings['premium_banner_image_custom_link']['url'] : get_permalink( $settings['premium_banner_image_existing_page_link'] ); |
| 739 | |
| 740 | $link_title = $settings['premium_banner_image_link_switcher'] != 'yes' ? get_the_title( $settings['premium_banner_image_existing_page_link'] ) : ''; |
| 741 | |
| 742 | $open_new_tab = $settings['premium_banner_image_link_open_new_tab'] == 'yes' ? ' target="_blank"' : ''; |
| 743 | $nofollow_link = $settings['premium_banner_image_link_add_nofollow'] == 'yes' ? ' rel="nofollow"' : ''; |
| 744 | $full_link = '<a class="premium_addons-banner-ib-link" href="'. $link .'" title="'. $link_title .'"'. $open_new_tab . $nofollow_link . '></a>'; |
| 745 | $animation_class = $settings['premium_banner_image_animation']; |
| 746 | $hover_class = ' ' . $settings['premium_banner_hover_effect']; |
| 747 | $extra_class = isset( $settings['premium_banner_extra_class'] ) && $settings['premium_banner_extra_class'] != '' ? ' '. $settings['premium_banner_extra_class'] : ''; |
| 748 | $active = $settings['premium_banner_active'] == 'yes' ? ' active' : ''; |
| 749 | $full_class = $animation_class.$hover_class.$extra_class.$active; |
| 750 | $min_size = $settings['premium_banner_min_range'].'px'; |
| 751 | $max_size = $settings['premium_banner_max_range'].'px'; |
| 752 | |
| 753 | |
| 754 | $banner_url = 'url' == $settings['premium_banner_link_selection'] ? $settings['premium_banner_link']['url'] : get_permalink($settings['premium_banner_existing_link']); |
| 755 | |
| 756 | ob_start(); |
| 757 | ?> |
| 758 | <div class="premium_banner" id="premium-banner-<?php echo esc_attr($this->get_id()); ?>"> |
| 759 | <div class="premium_addons-banner-ib <?php echo $full_class; ?> premium-banner-min-height"> |
| 760 | <?php if( isset( $settings['premium_banner_image']['url'] ) && $settings['premium_banner_image']['url'] != '' ): ?> |
| 761 | <?php if($settings['premium_banner_height'] == 'custom' ): ?> |
| 762 | <div class="premium_addons-banner-img-wrap"> |
| 763 | <?php endif; ?> |
| 764 | <img class="premium_addons-banner-ib-img" alt="null" src="<?php echo $settings['premium_banner_image']['url']; ?>"> |
| 765 | <?php if($settings['premium_banner_height'] == 'custom' ): ?> |
| 766 | </div> |
| 767 | <?php endif; ?> |
| 768 | <?php endif; ?> |
| 769 | <div class="premium_addons-banner-ib-desc"> |
| 770 | <?php echo $full_title; ?> |
| 771 | <div class="premium_addons-banner-ib-content premium_banner_content"> |
| 772 | <div <?php echo $this->get_render_attribute_string('premium_banner_description'); ?>><?php echo $settings[ 'premium_banner_description' ]; ?></div> |
| 773 | </div> |
| 774 | <?php if( 'yes' == $settings['premium_banner_link_switcher'] && !empty( $settings['premium_banner_more_text'] ) ) : ?> |
| 775 | |
| 776 | <div class ="premium-banner-read-more"> |
| 777 | <a class = "premium-banner-link" <?php if( !empty( $banner_url ) ) : ?> href="<?php echo esc_url( $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> |
| 778 | </div> |
| 779 | |
| 780 | <?php endif; ?> |
| 781 | </div> |
| 782 | <?php |
| 783 | if( $settings['premium_banner_link_url_switch'] == 'yes' && (!empty( $settings['premium_banner_image_custom_link']['url'] ) || !empty($settings['premium_banner_image_existing_page_link'] )) ) { |
| 784 | echo $full_link; |
| 785 | } |
| 786 | ?> |
| 787 | </div> |
| 788 | <?php if($settings['premium_banner_responsive_switcher'] == 'yes') : ?> |
| 789 | <style> |
| 790 | @media(min-width: <?php echo $min_size; ?> ) and (max-width:<?php echo $max_size; ?>){ |
| 791 | #premium-banner-<?php echo esc_attr($this->get_id()); ?> .premium_addons-banner-ib-content { |
| 792 | display: none; |
| 793 | } |
| 794 | } |
| 795 | </style> |
| 796 | <?php endif; ?> |
| 797 | |
| 798 | </div> |
| 799 | <?php $output = ob_get_clean(); |
| 800 | echo $output; |
| 801 | } |
| 802 | |
| 803 | protected function content_template() { |
| 804 | |
| 805 | ?> |
| 806 | |
| 807 | |
| 808 | <?php |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | Plugin::instance()->widgets_manager->register_widget_type( new Premium_Banner_Widget() ); |