theme-elements
6 years ago
accordion.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
carousel-navigation.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
gallery.php
6 years ago
gmap.php
6 years ago
heading-modern.php
6 years ago
icon.php
6 years ago
image.php
6 years ago
mailchimp.php
6 years ago
modern-button.php
6 years ago
quote.php
6 years ago
recent-comments.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-products.php
6 years ago
responsive-table.php
6 years ago
search.php
6 years ago
staff.php
6 years ago
svg.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
image.php
738 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Image_Size; |
| 8 | use Elementor\Group_Control_Typography; |
| 9 | use Elementor\Scheme_Typography; |
| 10 | use Elementor\Utils; |
| 11 | use Elementor\Group_Control_Border; |
| 12 | use Elementor\Group_Control_Box_Shadow; |
| 13 | use Elementor\Group_Control_Text_Shadow; |
| 14 | use Elementor\Group_Control_Background; |
| 15 | |
| 16 | |
| 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | exit; // Exit if accessed directly. |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Elementor 'Image' widget. |
| 23 | * |
| 24 | * Elementor widget that displays an 'Image' with lightbox. |
| 25 | * |
| 26 | * @since 1.0.0 |
| 27 | */ |
| 28 | class Image extends Widget_Base { |
| 29 | |
| 30 | /** |
| 31 | * Get widget name. |
| 32 | * |
| 33 | * Retrieve 'Image' widget name. |
| 34 | * |
| 35 | * @since 1.0.0 |
| 36 | * @access public |
| 37 | * |
| 38 | * @return string Widget name. |
| 39 | */ |
| 40 | public function get_name() { |
| 41 | return 'aux_image'; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Get widget title. |
| 46 | * |
| 47 | * Retrieve 'Image' widget title. |
| 48 | * |
| 49 | * @since 1.0.0 |
| 50 | * @access public |
| 51 | * |
| 52 | * @return string Widget title. |
| 53 | */ |
| 54 | public function get_title() { |
| 55 | return __('Advanced Image', 'auxin-elements' ); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Get widget icon. |
| 60 | * |
| 61 | * Retrieve 'Image' widget icon. |
| 62 | * |
| 63 | * @since 1.0.0 |
| 64 | * @access public |
| 65 | * |
| 66 | * @return string Widget icon. |
| 67 | */ |
| 68 | public function get_icon() { |
| 69 | return 'eicon-image auxin-badge'; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Get widget categories. |
| 74 | * |
| 75 | * Retrieve 'Image' widget icon. |
| 76 | * |
| 77 | * @since 1.0.0 |
| 78 | * @access public |
| 79 | * |
| 80 | * @return string Widget icon. |
| 81 | */ |
| 82 | public function get_categories() { |
| 83 | return array( 'auxin-core' ); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Register 'Image' widget controls. |
| 88 | * |
| 89 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 90 | * |
| 91 | * @since 1.0.0 |
| 92 | * @access protected |
| 93 | */ |
| 94 | protected function _register_controls() { |
| 95 | |
| 96 | /*-----------------------------------------------------------------------------------*/ |
| 97 | /* Content Tab |
| 98 | /*-----------------------------------------------------------------------------------*/ |
| 99 | |
| 100 | $this->start_controls_section( |
| 101 | 'image_section', |
| 102 | array( |
| 103 | 'label' => __('Image', 'auxin-elements' ), |
| 104 | ) |
| 105 | ); |
| 106 | |
| 107 | $this->add_control( |
| 108 | 'image', |
| 109 | array( |
| 110 | 'label' => __('Image','auxin-elements' ), |
| 111 | 'type' => Controls_Manager::MEDIA, |
| 112 | 'show_label' => false, |
| 113 | 'default' => array( |
| 114 | 'url' => Utils::get_placeholder_image_src() |
| 115 | ) |
| 116 | ) |
| 117 | ); |
| 118 | |
| 119 | $this->add_group_control( |
| 120 | Group_Control_Image_Size::get_type(), |
| 121 | array( |
| 122 | 'name' => 'image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`. |
| 123 | 'separator' => 'none', |
| 124 | 'default' => 'large' |
| 125 | ) |
| 126 | ); |
| 127 | |
| 128 | $this->add_control( |
| 129 | 'link', |
| 130 | array( |
| 131 | 'label' => __('Image Link','auxin-elements' ), |
| 132 | 'type' => Controls_Manager::URL, |
| 133 | 'placeholder' => 'http://phlox.pro', |
| 134 | 'show_external' => true, |
| 135 | 'dynamic' => [ |
| 136 | 'active' => true |
| 137 | ] |
| 138 | ) |
| 139 | ); |
| 140 | |
| 141 | $this->end_controls_section(); |
| 142 | |
| 143 | $this->start_controls_section( |
| 144 | 'hover_section', |
| 145 | array( |
| 146 | 'label' => __('Hover Image', 'auxin-elements' ), |
| 147 | ) |
| 148 | ); |
| 149 | |
| 150 | $this->add_control( |
| 151 | 'display_hover', |
| 152 | array( |
| 153 | 'label' => __('Display Hover Image','auxin-elements' ), |
| 154 | 'type' => Controls_Manager::SWITCHER, |
| 155 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 156 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 157 | 'return_value' => 'yes', |
| 158 | 'default' => 'no' |
| 159 | ) |
| 160 | ); |
| 161 | |
| 162 | $this->add_control( |
| 163 | 'hover_image', |
| 164 | array( |
| 165 | 'label' => __( 'Image', 'auxin-elements' ), |
| 166 | 'type' => Controls_Manager::MEDIA, |
| 167 | 'show_label' => false, |
| 168 | 'condition' => array( |
| 169 | 'display_hover' => 'yes' |
| 170 | ) |
| 171 | ) |
| 172 | ); |
| 173 | |
| 174 | $this->end_controls_section(); |
| 175 | |
| 176 | $this->start_controls_section( |
| 177 | 'ribbon_section', |
| 178 | array( |
| 179 | 'label' => __('Ribbon', 'auxin-elements' ), |
| 180 | ) |
| 181 | ); |
| 182 | |
| 183 | $this->add_control( |
| 184 | 'display_ribbon', |
| 185 | array( |
| 186 | 'label' => __('Diplay Ribbon','auxin-elements' ), |
| 187 | 'type' => Controls_Manager::SWITCHER, |
| 188 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 189 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 190 | 'return_value' => 'yes', |
| 191 | 'default' => 'no' |
| 192 | ) |
| 193 | ); |
| 194 | |
| 195 | $this->add_control( |
| 196 | 'ribbon_text', |
| 197 | array( |
| 198 | 'label' => __('Text','auxin-elements' ), |
| 199 | 'type' => Controls_Manager::TEXT, |
| 200 | 'default' => 'NEW', |
| 201 | 'condition' => array( |
| 202 | 'display_ribbon' => 'yes' |
| 203 | ) |
| 204 | ) |
| 205 | ); |
| 206 | |
| 207 | $this->add_control( |
| 208 | 'ribbon_style', |
| 209 | array( |
| 210 | 'label' => __('Ribbon Style', 'auxin-elements'), |
| 211 | 'type' => Controls_Manager::SELECT, |
| 212 | 'default' => 'simple', |
| 213 | 'options' => array( |
| 214 | 'simple' => __('Simple' , 'auxin-elements' ) , |
| 215 | 'corner' => __('Corner' , 'auxin-elements' ), |
| 216 | 'cross' => __('Cross' , 'auxin-elements' ) |
| 217 | ), |
| 218 | 'condition' => array( |
| 219 | 'display_ribbon' => 'yes' |
| 220 | ) |
| 221 | ) |
| 222 | ); |
| 223 | |
| 224 | $this->add_control( |
| 225 | 'ribbon_position', |
| 226 | array( |
| 227 | 'label' => __('Ribbon Position', 'auxin-elements'), |
| 228 | 'type' => Controls_Manager::SELECT, |
| 229 | 'default' => 'top-right', |
| 230 | 'options' => array( |
| 231 | 'top-left' => __('Top Left' , 'auxin-elements' ) , |
| 232 | 'top-right' => __('Top Right' , 'auxin-elements' ), |
| 233 | 'bottom-left' => __('Bottom Left' , 'auxin-elements' ), |
| 234 | 'bottom-right' => __('Bottom Right' , 'auxin-elements' ) |
| 235 | ), |
| 236 | 'condition' => array( |
| 237 | 'display_ribbon' => 'yes' |
| 238 | ) |
| 239 | ) |
| 240 | ); |
| 241 | |
| 242 | $this->add_responsive_control( |
| 243 | 'ribbon_thickness', |
| 244 | array( |
| 245 | 'label' => __('Ribbon Thickness','auxin-elements' ), |
| 246 | 'type' => Controls_Manager::SLIDER, |
| 247 | 'size_units' => array('px', 'em'), |
| 248 | 'range' => array( |
| 249 | 'px' => array( |
| 250 | 'min' => 0, |
| 251 | 'max' => 50, |
| 252 | 'step' => 1 |
| 253 | ), |
| 254 | 'em' => array( |
| 255 | 'min' => 0, |
| 256 | 'max' => 3, |
| 257 | 'step' => 0.1 |
| 258 | ) |
| 259 | ), |
| 260 | 'selectors' => array( |
| 261 | '{{WRAPPER}} .aux-ribbon-wrapper' => 'line-height: {{SIZE}}{{UNIT}};', |
| 262 | ), |
| 263 | 'condition' => array( |
| 264 | 'display_ribbon' => 'yes' |
| 265 | ) |
| 266 | ) |
| 267 | ); |
| 268 | |
| 269 | $this->end_controls_section(); |
| 270 | |
| 271 | /*-----------------------------------------------------------------------------------*/ |
| 272 | /* Content Tab |
| 273 | /*-----------------------------------------------------------------------------------*/ |
| 274 | |
| 275 | $this->start_controls_section( |
| 276 | 'template_section', |
| 277 | array( |
| 278 | 'label' => __('Settings', 'auxin-elements' ), |
| 279 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 280 | ) |
| 281 | ); |
| 282 | |
| 283 | $this->add_control( |
| 284 | 'lightbox', |
| 285 | array( |
| 286 | 'label' => __('Open in lightbox','auxin-elements' ), |
| 287 | 'type' => Controls_Manager::SWITCHER, |
| 288 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 289 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 290 | 'return_value' => 'yes', |
| 291 | 'default' => 'no' |
| 292 | ) |
| 293 | ); |
| 294 | |
| 295 | $this->add_control( |
| 296 | 'icon', |
| 297 | array( |
| 298 | 'label' => __( 'Iconic button', 'auxin-elements'), |
| 299 | 'type' => Controls_Manager::SELECT, |
| 300 | 'default' => 'plus', |
| 301 | 'options' => array( |
| 302 | 'none' => __('None', 'auxin-elements' ), |
| 303 | 'plus' => __('Plus', 'auxin-elements' ) |
| 304 | ), |
| 305 | 'condition' => array( |
| 306 | 'lightbox' => 'yes' |
| 307 | ) |
| 308 | ) |
| 309 | ); |
| 310 | |
| 311 | $this->add_responsive_control( |
| 312 | 'alignment', |
| 313 | array( |
| 314 | 'label' => __('Alignment','auxin-elements' ), |
| 315 | 'description' => __('Image alignment in block.', 'auxin-elements' ), |
| 316 | 'type' => Controls_Manager::CHOOSE, |
| 317 | 'options' => array( |
| 318 | 'left' => array( |
| 319 | 'title' => __( 'Left', 'auxin-elements' ), |
| 320 | 'icon' => 'fa fa-align-left', |
| 321 | ), |
| 322 | 'center' => array( |
| 323 | 'title' => __( 'Center', 'auxin-elements' ), |
| 324 | 'icon' => 'fa fa-align-center', |
| 325 | ), |
| 326 | 'right' => array( |
| 327 | 'title' => __( 'Right', 'auxin-elements' ), |
| 328 | 'icon' => 'fa fa-align-right', |
| 329 | ) |
| 330 | ), |
| 331 | 'default' => '', |
| 332 | 'separator' => 'after', |
| 333 | 'toggle' => true, |
| 334 | 'selectors' => array( |
| 335 | '{{WRAPPER}} .aux-widget-image' => 'text-align: {{VALUE}};', |
| 336 | ) |
| 337 | ) |
| 338 | ); |
| 339 | |
| 340 | $this->add_control( |
| 341 | 'preloadable', |
| 342 | array( |
| 343 | 'label' => __('Preload image','auxin-elements' ), |
| 344 | 'type' => Controls_Manager::SWITCHER, |
| 345 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 346 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 347 | 'return_value' => 'yes', |
| 348 | 'default' => 'no' |
| 349 | ) |
| 350 | ); |
| 351 | |
| 352 | $this->add_control( |
| 353 | 'preload_preview', |
| 354 | array( |
| 355 | 'label' => __('While loading image display','auxin-elements' ), |
| 356 | 'label_block' => true, |
| 357 | 'type' => Controls_Manager::SELECT, |
| 358 | 'options' => auxin_get_preloadable_previews(), |
| 359 | 'return_value' => 'yes', |
| 360 | 'default' => 'yes', |
| 361 | 'condition' => array( |
| 362 | 'preloadable' => 'yes' |
| 363 | ) |
| 364 | ) |
| 365 | ); |
| 366 | |
| 367 | $this->add_control( |
| 368 | 'preload_bgcolor', |
| 369 | array( |
| 370 | 'label' => __( 'Placeholder color while loading image', 'auxin-elements' ), |
| 371 | 'type' => Controls_Manager::COLOR, |
| 372 | 'condition' => array( |
| 373 | 'preloadable' => 'yes', |
| 374 | 'preload_preview' => array('no', 'simple-spinner', 'simple-spinner-light', 'simple-spinner-dark') |
| 375 | ) |
| 376 | ) |
| 377 | ); |
| 378 | |
| 379 | $this->add_control( |
| 380 | 'tilt', |
| 381 | array( |
| 382 | 'label' => __( 'Tilt Effect','auxin-elements' ), |
| 383 | 'description' => __( 'Adds tilt effect to the image.', 'auxin-elements' ), |
| 384 | 'type' => Controls_Manager::SWITCHER, |
| 385 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 386 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 387 | 'return_value' => 'yes', |
| 388 | 'default' => 'no', |
| 389 | 'separator' => 'before' |
| 390 | ) |
| 391 | ); |
| 392 | |
| 393 | $this->add_control( |
| 394 | 'colorized_shadow', |
| 395 | array( |
| 396 | 'label' => __( 'Colorized Shadow', 'auxin-elements' ), |
| 397 | 'description' => __( 'Adds colorized shadow to the image. Note: This feature is not available when image hover is active.', 'auxin-elements' ), |
| 398 | 'type' => Controls_Manager::SWITCHER, |
| 399 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 400 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 401 | 'return_value' => 'yes', |
| 402 | 'default' => 'no', |
| 403 | 'condition' => array( |
| 404 | 'display_hover!' => 'yes' |
| 405 | ) |
| 406 | ) |
| 407 | ); |
| 408 | |
| 409 | $this->end_controls_section(); |
| 410 | |
| 411 | /*-----------------------------------------------------------------------------------*/ |
| 412 | /* Style Tab |
| 413 | /*-----------------------------------------------------------------------------------*/ |
| 414 | |
| 415 | $this->start_controls_section( |
| 416 | 'image_style_section', |
| 417 | array( |
| 418 | 'label' => __( 'Image', 'auxin-elements' ), |
| 419 | 'tab' => Controls_Manager::TAB_STYLE, |
| 420 | 'condition' => array( |
| 421 | 'image!' => '', |
| 422 | ), |
| 423 | ) |
| 424 | ); |
| 425 | |
| 426 | $this->add_responsive_control( |
| 427 | 'image_max_width', |
| 428 | array( |
| 429 | 'label' => __('Max Width','auxin-elements' ), |
| 430 | 'type' => Controls_Manager::SLIDER, |
| 431 | 'size_units' => array('px', 'em','%'), |
| 432 | 'range' => array( |
| 433 | '%' => array( |
| 434 | 'min' => 1, |
| 435 | 'max' => 100, |
| 436 | 'step' => 1 |
| 437 | ), |
| 438 | 'em' => array( |
| 439 | 'min' => 1, |
| 440 | 'max' => 100, |
| 441 | 'step' => 1 |
| 442 | ), |
| 443 | 'px' => array( |
| 444 | 'min' => 1, |
| 445 | 'max' => 1600, |
| 446 | 'step' => 1 |
| 447 | ) |
| 448 | ), |
| 449 | 'selectors' => array( |
| 450 | '{{WRAPPER}} .aux-media-image' => 'max-width:{{SIZE}}{{UNIT}};' |
| 451 | ) |
| 452 | ) |
| 453 | ); |
| 454 | |
| 455 | $this->add_responsive_control( |
| 456 | 'image_max_height', |
| 457 | array( |
| 458 | 'label' => __('Max Height','auxin-elements' ), |
| 459 | 'type' => Controls_Manager::SLIDER, |
| 460 | 'size_units' => array('px', 'em','%'), |
| 461 | 'range' => array( |
| 462 | '%' => array( |
| 463 | 'min' => 1, |
| 464 | 'max' => 100, |
| 465 | 'step' => 1 |
| 466 | ), |
| 467 | 'em' => array( |
| 468 | 'min' => 1, |
| 469 | 'max' => 100, |
| 470 | 'step' => 1 |
| 471 | ), |
| 472 | 'px' => array( |
| 473 | 'min' => 1, |
| 474 | 'max' => 1600, |
| 475 | 'step' => 1 |
| 476 | ) |
| 477 | ), |
| 478 | 'selectors' => array( |
| 479 | '{{WRAPPER}} .aux-media-image' => 'max-height:{{SIZE}}{{UNIT}};' |
| 480 | ) |
| 481 | ) |
| 482 | ); |
| 483 | |
| 484 | $this->add_responsive_control( |
| 485 | 'image_border_radius', |
| 486 | array( |
| 487 | 'label' => __( 'Border radius', 'auxin-elements' ), |
| 488 | 'type' => Controls_Manager::DIMENSIONS, |
| 489 | 'size_units' => array( 'px', 'em', '%' ), |
| 490 | 'selectors' => array( |
| 491 | '{{WRAPPER}} .aux-media-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow:hidden;', |
| 492 | ), |
| 493 | 'separator' => 'after' |
| 494 | ) |
| 495 | ); |
| 496 | |
| 497 | $this->start_controls_tabs( 'image_style_tabs' ); |
| 498 | |
| 499 | $this->start_controls_tab( |
| 500 | 'image_status_normal', |
| 501 | array( |
| 502 | 'label' => __( 'Normal' , 'auxin-elements' ) |
| 503 | ) |
| 504 | ); |
| 505 | |
| 506 | $this->add_group_control( |
| 507 | Group_Control_Box_Shadow::get_type(), |
| 508 | array( |
| 509 | 'name' => 'image_box_shadow', |
| 510 | 'selector' => '{{WRAPPER}} .aux-media-image', |
| 511 | 'separator' => 'none' |
| 512 | ) |
| 513 | ); |
| 514 | |
| 515 | $this->add_group_control( |
| 516 | Group_Control_Border::get_type(), |
| 517 | array( |
| 518 | 'name' => 'image_border', |
| 519 | 'selector' => '{{WRAPPER}} .aux-media-image', |
| 520 | 'separator' => 'none' |
| 521 | ) |
| 522 | ); |
| 523 | |
| 524 | $this->add_group_control( |
| 525 | Group_Control_Background::get_type(), |
| 526 | array( |
| 527 | 'name' => 'image_background', |
| 528 | 'selector' => '{{WRAPPER}} .aux-media-image', |
| 529 | 'separator' => 'none' |
| 530 | ) |
| 531 | ); |
| 532 | |
| 533 | $this->end_controls_tab(); |
| 534 | |
| 535 | |
| 536 | $this->start_controls_tab( |
| 537 | 'image_status_hover', |
| 538 | array( |
| 539 | 'label' => __( 'Hover' , 'auxin-elements' ) |
| 540 | ) |
| 541 | ); |
| 542 | |
| 543 | $this->add_group_control( |
| 544 | Group_Control_Box_Shadow::get_type(), |
| 545 | array( |
| 546 | 'name' => 'image_box_shadow_hover', |
| 547 | 'selector' => '{{WRAPPER}} .aux-media-image:hover', |
| 548 | 'separator' => 'none' |
| 549 | ) |
| 550 | ); |
| 551 | |
| 552 | $this->add_group_control( |
| 553 | Group_Control_Border::get_type(), |
| 554 | array( |
| 555 | 'name' => 'image_border_hover', |
| 556 | 'selector' => '{{WRAPPER}} .aux-media-image:hover', |
| 557 | 'separator' => 'none' |
| 558 | ) |
| 559 | ); |
| 560 | |
| 561 | $this->add_group_control( |
| 562 | Group_Control_Background::get_type(), |
| 563 | array( |
| 564 | 'name' => 'image_background_hover', |
| 565 | 'selector' => '{{WRAPPER}} .aux-media-image:hover', |
| 566 | 'separator' => 'none' |
| 567 | ) |
| 568 | ); |
| 569 | |
| 570 | $this->add_control( |
| 571 | 'image_transition_duration', |
| 572 | array( |
| 573 | 'label' => __('Transition Duration','auxin-elements' ), |
| 574 | 'type' => Controls_Manager::SLIDER, |
| 575 | 'range' => array( |
| 576 | 'px' => array( |
| 577 | 'min' => 0, |
| 578 | 'max' => 2000, |
| 579 | 'step' => 10 |
| 580 | ) |
| 581 | ), |
| 582 | 'selectors' => array( |
| 583 | '{{WRAPPER}} .aux-media-image' => 'transition-duration: {{SIZE}}ms;', |
| 584 | ) |
| 585 | ) |
| 586 | ); |
| 587 | |
| 588 | $this->add_responsive_control( |
| 589 | 'image_translate_y', |
| 590 | array( |
| 591 | 'label' => __('Vertical Move','auxin-elements' ), |
| 592 | 'type' => Controls_Manager::SLIDER, |
| 593 | 'size_units' => array('px', 'em', '%'), |
| 594 | 'range' => array( |
| 595 | 'px' => array( |
| 596 | 'min' => -100, |
| 597 | 'max' => 100, |
| 598 | 'step' => 10 |
| 599 | ) |
| 600 | ), |
| 601 | 'selectors' => array( |
| 602 | '{{WRAPPER}} .aux-media-image:hover' => 'transform: translateY({{SIZE}}{{UNIT}});', |
| 603 | ) |
| 604 | ) |
| 605 | ); |
| 606 | |
| 607 | $this->end_controls_tab(); |
| 608 | |
| 609 | $this->end_controls_tabs(); |
| 610 | |
| 611 | $this->end_controls_section(); |
| 612 | |
| 613 | |
| 614 | $this->start_controls_section( |
| 615 | 'ribbon_style_section', |
| 616 | array( |
| 617 | 'label' => __( 'Ribbon', 'auxin-elements' ), |
| 618 | 'tab' => Controls_Manager::TAB_STYLE, |
| 619 | 'condition' => array( |
| 620 | 'display_ribbon' => 'yes', |
| 621 | ), |
| 622 | ) |
| 623 | ); |
| 624 | |
| 625 | $this->add_control( |
| 626 | 'ribbon_bg_color', |
| 627 | array( |
| 628 | 'label' => __( 'Background Color', 'auxin-elements' ), |
| 629 | 'type' => Controls_Manager::COLOR, |
| 630 | 'selectors' => array( |
| 631 | '{{WRAPPER}} .aux-ribbon-wrapper' => 'background-color: {{VALUE}} !important;', |
| 632 | ) |
| 633 | ) |
| 634 | ); |
| 635 | |
| 636 | $this->add_control( |
| 637 | 'ribbon_border_color', |
| 638 | array( |
| 639 | 'label' => __( 'Border Color', 'auxin-elements' ), |
| 640 | 'type' => Controls_Manager::COLOR, |
| 641 | 'selectors' => array( |
| 642 | '{{WRAPPER}} .aux-ribbon-wrapper::before' => 'border-color: {{VALUE}};', |
| 643 | ), |
| 644 | 'condition' => array( |
| 645 | 'ribbon_style' => array('cross'), |
| 646 | ), |
| 647 | ) |
| 648 | ); |
| 649 | |
| 650 | $this->add_group_control( |
| 651 | Group_Control_Box_Shadow::get_type(), |
| 652 | array( |
| 653 | 'label' => __( 'Box Shadow', 'auxin-elements' ), |
| 654 | 'name' => 'header_box_shadow', |
| 655 | 'selector' => '{{WRAPPER}} .aux-ribbon-wrapper' |
| 656 | ) |
| 657 | ); |
| 658 | |
| 659 | $this->add_control( |
| 660 | 'ribbon_text_color', |
| 661 | array( |
| 662 | 'label' => __( 'Text Color', 'auxin-elements' ), |
| 663 | 'type' => Controls_Manager::COLOR, |
| 664 | 'selectors' => array( |
| 665 | '{{WRAPPER}} .aux-ribbon-wrapper span' => 'color: {{VALUE}} !important;', |
| 666 | ) |
| 667 | ) |
| 668 | ); |
| 669 | |
| 670 | $this->add_group_control( |
| 671 | Group_Control_Typography::get_type(), |
| 672 | array( |
| 673 | 'name' => 'ribbon_typography', |
| 674 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 675 | 'selector' => '{{WRAPPER}} .aux-ribbon-wrapper span' |
| 676 | ) |
| 677 | ); |
| 678 | |
| 679 | $this->add_group_control( |
| 680 | Group_Control_Text_Shadow::get_type(), |
| 681 | array( |
| 682 | 'name' => 'ribbon_text_shadow', |
| 683 | 'label' => __( 'Text Shadow', 'auxin-elements' ), |
| 684 | 'selector' => '{{WRAPPER}} .aux-ribbon-wrapper span', |
| 685 | ) |
| 686 | ); |
| 687 | |
| 688 | $this->end_controls_section(); |
| 689 | } |
| 690 | |
| 691 | /** |
| 692 | * Render image box widget output on the frontend. |
| 693 | * |
| 694 | * Written in PHP and used to generate the final HTML. |
| 695 | * |
| 696 | * @since 1.0.0 |
| 697 | * @access protected |
| 698 | */ |
| 699 | protected function render() { |
| 700 | |
| 701 | $settings = $this->get_settings_for_display(); |
| 702 | |
| 703 | $link_target = $settings['link']['is_external'] ? '_blank' : '_self'; |
| 704 | |
| 705 | $args = array( |
| 706 | 'image_html' => Group_Control_Image_Size::get_attachment_image_html( $settings, 'image' ), |
| 707 | |
| 708 | 'attach_id' => $settings['image']['id'], |
| 709 | 'size' => $settings['image_size'], |
| 710 | 'width' => $settings['image_custom_dimension']['width'], |
| 711 | 'height' => $settings['image_custom_dimension']['height'], |
| 712 | 'link' => $settings['link']['url'], |
| 713 | 'nofollow' => $settings['link']['nofollow'], |
| 714 | 'target' => $link_target, |
| 715 | |
| 716 | 'attach_id_hover' => $settings['hover_image']['id'], |
| 717 | |
| 718 | 'display_ribbon' => $settings['display_ribbon'], |
| 719 | 'ribbon_text' => $settings['ribbon_text'], |
| 720 | 'ribbon_style' => $settings['ribbon_style'], |
| 721 | 'ribbon_position' => $settings['ribbon_position'], |
| 722 | |
| 723 | 'lightbox' => $settings['lightbox'], |
| 724 | 'icon' => $settings['icon'], |
| 725 | 'preloadable' => $settings['preloadable'], |
| 726 | 'preload_preview' => $settings['preload_preview'], |
| 727 | 'preload_bgcolor' => $settings['preload_bgcolor'], |
| 728 | 'tilt' => $settings['tilt'], |
| 729 | 'colorized_shadow' => $settings['colorized_shadow'] |
| 730 | //'align' => $settings['align'], |
| 731 | ); |
| 732 | |
| 733 | // pass the args through the corresponding shortcode callback |
| 734 | echo auxin_widget_image_callback( $args ); |
| 735 | } |
| 736 | |
| 737 | } |
| 738 |