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
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
touch-slider.php
482 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_Typography; |
| 8 | use Elementor\Scheme_Typography; |
| 9 | |
| 10 | |
| 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | exit; // Exit if accessed directly. |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Elementor 'TouchSlider' widget. |
| 17 | * |
| 18 | * Elementor widget that displays an 'TouchSlider' with lightbox. |
| 19 | * |
| 20 | * @since 1.0.0 |
| 21 | */ |
| 22 | class TouchSlider extends Widget_Base { |
| 23 | |
| 24 | /** |
| 25 | * Get widget name. |
| 26 | * |
| 27 | * Retrieve 'TouchSlider' widget name. |
| 28 | * |
| 29 | * @since 1.0.0 |
| 30 | * @access public |
| 31 | * |
| 32 | * @return string Widget name. |
| 33 | */ |
| 34 | public function get_name() { |
| 35 | return 'aux_touch_slider'; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Get widget title. |
| 40 | * |
| 41 | * Retrieve 'TouchSlider' widget title. |
| 42 | * |
| 43 | * @since 1.0.0 |
| 44 | * @access public |
| 45 | * |
| 46 | * @return string Widget title. |
| 47 | */ |
| 48 | public function get_title() { |
| 49 | return __( 'Simple Image Slider', 'auxin-elements' ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Get widget icon. |
| 54 | * |
| 55 | * Retrieve 'TouchSlider' widget icon. |
| 56 | * |
| 57 | * @since 1.0.0 |
| 58 | * @access public |
| 59 | * |
| 60 | * @return string Widget icon. |
| 61 | */ |
| 62 | public function get_icon() { |
| 63 | return 'eicon-slider-device auxin-badge'; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Get widget categories. |
| 68 | * |
| 69 | * Retrieve 'TouchSlider' widget icon. |
| 70 | * |
| 71 | * @since 1.0.0 |
| 72 | * @access public |
| 73 | * |
| 74 | * @return string Widget icon. |
| 75 | */ |
| 76 | public function get_categories() { |
| 77 | return array( 'auxin-core' ); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | /** |
| 82 | * Register 'TouchSlider' widget controls. |
| 83 | * |
| 84 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 85 | * |
| 86 | * @since 1.0.0 |
| 87 | * @access protected |
| 88 | */ |
| 89 | protected function _register_controls() { |
| 90 | |
| 91 | /*-----------------------------------------------------------------------------------*/ |
| 92 | /* images_section |
| 93 | /*-----------------------------------------------------------------------------------*/ |
| 94 | |
| 95 | $this->start_controls_section( |
| 96 | 'images_section', |
| 97 | array( |
| 98 | 'label' => __('Images', 'auxin-elements' ) |
| 99 | ) |
| 100 | ); |
| 101 | |
| 102 | $this->add_control( |
| 103 | 'images', |
| 104 | array( |
| 105 | 'label' => __( 'Add Images', 'auxin-elements' ), |
| 106 | 'type' => Controls_Manager::GALLERY, |
| 107 | 'show_label' => false, |
| 108 | ) |
| 109 | ); |
| 110 | |
| 111 | $this->end_controls_section(); |
| 112 | |
| 113 | /*-----------------------------------------------------------------------------------*/ |
| 114 | /* display_section |
| 115 | /*-----------------------------------------------------------------------------------*/ |
| 116 | |
| 117 | $this->start_controls_section( |
| 118 | 'display_section', |
| 119 | array( |
| 120 | 'label' => __('Display', 'auxin-elements' ) |
| 121 | ) |
| 122 | ); |
| 123 | |
| 124 | $this->add_control( |
| 125 | 'arrows', |
| 126 | array( |
| 127 | 'label' => __('Arrow navigation','auxin-elements' ), |
| 128 | 'type' => Controls_Manager::SWITCHER, |
| 129 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 130 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 131 | 'return_value' => 'yes', |
| 132 | 'default' => 'yes' |
| 133 | ) |
| 134 | ); |
| 135 | |
| 136 | |
| 137 | $this->add_control( |
| 138 | 'loop', |
| 139 | array( |
| 140 | 'label' => __('Loop navigation','auxin-elements' ), |
| 141 | 'type' => Controls_Manager::SWITCHER, |
| 142 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 143 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 144 | 'return_value' => 'yes', |
| 145 | 'default' => 'yes' |
| 146 | ) |
| 147 | ); |
| 148 | |
| 149 | $this->add_control( |
| 150 | 'slideshow', |
| 151 | array( |
| 152 | 'label' => __('Slideshow','auxin-elements' ), |
| 153 | 'type' => Controls_Manager::SWITCHER, |
| 154 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 155 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 156 | 'return_value' => 'yes', |
| 157 | 'default' => 'no' |
| 158 | ) |
| 159 | ); |
| 160 | |
| 161 | $this->add_control( |
| 162 | 'slideshow_delay', |
| 163 | array( |
| 164 | 'label' => __( 'Autoplay delay', 'auxin-elements' ), |
| 165 | 'description' => __('Specifies the delay between auto-forwarding in seconds.', 'auxin-elements' ), |
| 166 | 'type' => Controls_Manager::NUMBER, |
| 167 | 'default' => '2', |
| 168 | 'condition' => array( |
| 169 | 'slideshow' => 'yes', |
| 170 | ) |
| 171 | ) |
| 172 | ); |
| 173 | |
| 174 | $this->add_control( |
| 175 | 'add_title', |
| 176 | array( |
| 177 | 'label' => __('Display image title','auxin-elements' ), |
| 178 | 'type' => Controls_Manager::SWITCHER, |
| 179 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 180 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 181 | 'return_value' => 'yes', |
| 182 | 'default' => 'yes' |
| 183 | ) |
| 184 | ); |
| 185 | |
| 186 | $this->add_control( |
| 187 | 'add_caption', |
| 188 | array( |
| 189 | 'label' => __('Display image caption','auxin-elements' ), |
| 190 | 'type' => Controls_Manager::SWITCHER, |
| 191 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 192 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 193 | 'return_value' => 'yes', |
| 194 | 'default' => 'yes' |
| 195 | ) |
| 196 | ); |
| 197 | |
| 198 | $this->end_controls_section(); |
| 199 | |
| 200 | /*-----------------------------------------------------------------------------------*/ |
| 201 | /* slides_section |
| 202 | /*-----------------------------------------------------------------------------------*/ |
| 203 | |
| 204 | $this->start_controls_section( |
| 205 | 'slides_section', |
| 206 | array( |
| 207 | 'label' => __('Slides', 'auxin-elements' ), |
| 208 | 'tab' => Controls_Manager::TAB_STYLE |
| 209 | ) |
| 210 | ); |
| 211 | |
| 212 | $this->add_control( |
| 213 | 'width', |
| 214 | array( |
| 215 | 'label' => __('Slider image width','auxin-elements' ), |
| 216 | 'type' => Controls_Manager::SLIDER, |
| 217 | 'size_units' => array('px'), |
| 218 | 'range' => array( |
| 219 | 'px' => array( |
| 220 | 'min' => 1, |
| 221 | 'max' => 2000, |
| 222 | 'step' => 1 |
| 223 | ) |
| 224 | ), |
| 225 | 'default' => array( |
| 226 | 'unit' => 'px', |
| 227 | 'size' => 960 |
| 228 | ) |
| 229 | ) |
| 230 | ); |
| 231 | |
| 232 | $this->add_control( |
| 233 | 'height', |
| 234 | array( |
| 235 | 'label' => __('Slider image height','auxin-elements' ), |
| 236 | 'type' => Controls_Manager::SLIDER, |
| 237 | 'size_units' => array('px'), |
| 238 | 'range' => array( |
| 239 | 'px' => array( |
| 240 | 'min' => 1, |
| 241 | 'max' => 2000, |
| 242 | 'step' => 1 |
| 243 | ) |
| 244 | ), |
| 245 | 'default' => array( |
| 246 | 'unit' => 'px', |
| 247 | 'size' => 560 |
| 248 | ) |
| 249 | ) |
| 250 | ); |
| 251 | |
| 252 | $this->add_control( |
| 253 | 'space', |
| 254 | array( |
| 255 | 'label' => __('Space between slides','auxin-elements' ), |
| 256 | 'type' => Controls_Manager::SLIDER, |
| 257 | 'size_units' => array('px'), |
| 258 | 'range' => array( |
| 259 | 'px' => array( |
| 260 | 'min' => 1, |
| 261 | 'max' => 200, |
| 262 | 'step' => 1 |
| 263 | ) |
| 264 | ), |
| 265 | 'default' => array( |
| 266 | 'unit' => 'px', |
| 267 | 'size' => 0 |
| 268 | ) |
| 269 | ) |
| 270 | ); |
| 271 | |
| 272 | $this->end_controls_section(); |
| 273 | |
| 274 | /*-----------------------------------------------------------------------------------*/ |
| 275 | /* info_section |
| 276 | /*-----------------------------------------------------------------------------------*/ |
| 277 | |
| 278 | $this->start_controls_section( |
| 279 | 'info_section', |
| 280 | array( |
| 281 | 'label' => __('Info Container', 'auxin-elements' ), |
| 282 | 'tab' => Controls_Manager::TAB_STYLE, |
| 283 | 'conditions' => array( |
| 284 | 'relation' => 'or', |
| 285 | 'terms' => array( |
| 286 | array( |
| 287 | 'name' => 'add_title', |
| 288 | 'operator' => '===', |
| 289 | 'value' => 'yes', |
| 290 | ), array( |
| 291 | 'name' => 'add_caption', |
| 292 | 'operator' => '===', |
| 293 | 'value' => 'yes', |
| 294 | ), |
| 295 | ), |
| 296 | ), |
| 297 | ) |
| 298 | ); |
| 299 | |
| 300 | $this->add_control( |
| 301 | 'info_color', |
| 302 | array( |
| 303 | 'label' => __( 'Background Color', 'auxin-elements' ), |
| 304 | 'type' => Controls_Manager::COLOR, |
| 305 | 'selectors' => array( |
| 306 | '{{WRAPPER}} .aux-info-container' => 'background: {{VALUE}};', |
| 307 | ) |
| 308 | ) |
| 309 | ); |
| 310 | |
| 311 | $this->add_responsive_control( |
| 312 | 'info_padding', |
| 313 | array( |
| 314 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 315 | 'type' => Controls_Manager::DIMENSIONS, |
| 316 | 'size_units' => array( 'px', '%' ), |
| 317 | 'selectors' => array( |
| 318 | '{{WRAPPER}} .aux-info-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 319 | ) |
| 320 | ) |
| 321 | ); |
| 322 | |
| 323 | $this->end_controls_section(); |
| 324 | |
| 325 | /*-----------------------------------------------------------------------------------*/ |
| 326 | /* title_section |
| 327 | /*-----------------------------------------------------------------------------------*/ |
| 328 | |
| 329 | $this->start_controls_section( |
| 330 | 'title_section', |
| 331 | array( |
| 332 | 'label' => __('Title', 'auxin-elements' ), |
| 333 | 'tab' => Controls_Manager::TAB_STYLE, |
| 334 | 'condition' => array( |
| 335 | 'add_title' => 'yes', |
| 336 | ) |
| 337 | ) |
| 338 | ); |
| 339 | |
| 340 | $this->add_control( |
| 341 | 'title_color', |
| 342 | array( |
| 343 | 'label' => __( 'Color', 'auxin-elements' ), |
| 344 | 'type' => Controls_Manager::COLOR, |
| 345 | 'selectors' => array( |
| 346 | '{{WRAPPER}} .aux-slide-title h3' => 'color: {{VALUE}};', |
| 347 | ), |
| 348 | 'condition' => array( |
| 349 | 'add_title' => 'yes', |
| 350 | ) |
| 351 | ) |
| 352 | ); |
| 353 | |
| 354 | $this->add_group_control( |
| 355 | Group_Control_Typography::get_type(), |
| 356 | array( |
| 357 | 'name' => 'title_typography', |
| 358 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 359 | 'selector' => '{{WRAPPER}} .aux-slide-title h3', |
| 360 | 'condition' => array( |
| 361 | 'add_title' => 'yes', |
| 362 | ) |
| 363 | ) |
| 364 | ); |
| 365 | |
| 366 | $this->add_responsive_control( |
| 367 | 'title_padding', |
| 368 | array( |
| 369 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 370 | 'type' => Controls_Manager::DIMENSIONS, |
| 371 | 'size_units' => array( 'px', '%' ), |
| 372 | 'selectors' => array( |
| 373 | '{{WRAPPER}} .aux-slide-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 374 | ), |
| 375 | 'condition' => array( |
| 376 | 'add_title' => 'yes', |
| 377 | ) |
| 378 | ) |
| 379 | ); |
| 380 | |
| 381 | $this->end_controls_section(); |
| 382 | |
| 383 | /*-----------------------------------------------------------------------------------*/ |
| 384 | /* caption_section |
| 385 | /*-----------------------------------------------------------------------------------*/ |
| 386 | |
| 387 | $this->start_controls_section( |
| 388 | 'caption_section', |
| 389 | array( |
| 390 | 'label' => __('Caption', 'auxin-elements' ), |
| 391 | 'tab' => Controls_Manager::TAB_STYLE, |
| 392 | 'condition' => array( |
| 393 | 'add_caption' => 'yes', |
| 394 | ) |
| 395 | ) |
| 396 | ); |
| 397 | |
| 398 | $this->add_control( |
| 399 | 'caption_color', |
| 400 | array( |
| 401 | 'label' => __( 'Color', 'auxin-elements' ), |
| 402 | 'type' => Controls_Manager::COLOR, |
| 403 | 'selectors' => array( |
| 404 | '{{WRAPPER}} .aux-slide-info' => 'color: {{VALUE}};', |
| 405 | ), |
| 406 | 'condition' => array( |
| 407 | 'add_caption' => 'yes', |
| 408 | ) |
| 409 | ) |
| 410 | ); |
| 411 | |
| 412 | $this->add_group_control( |
| 413 | Group_Control_Typography::get_type(), |
| 414 | array( |
| 415 | 'name' => 'caption_typography', |
| 416 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 417 | 'selector' => '{{WRAPPER}} .aux-slide-info', |
| 418 | 'condition' => array( |
| 419 | 'add_caption' => 'yes', |
| 420 | ) |
| 421 | ) |
| 422 | ); |
| 423 | |
| 424 | $this->add_responsive_control( |
| 425 | 'caption_padding', |
| 426 | array( |
| 427 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 428 | 'type' => Controls_Manager::DIMENSIONS, |
| 429 | 'size_units' => array( 'px', '%' ), |
| 430 | 'selectors' => array( |
| 431 | '{{WRAPPER}} .aux-slide-info' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 432 | ), |
| 433 | 'condition' => array( |
| 434 | 'add_caption' => 'yes', |
| 435 | ) |
| 436 | ) |
| 437 | ); |
| 438 | |
| 439 | $this->end_controls_section(); |
| 440 | } |
| 441 | |
| 442 | /** |
| 443 | * Render image box widget output on the frontend. |
| 444 | * |
| 445 | * Written in PHP and used to generate the final HTML. |
| 446 | * |
| 447 | * @since 1.0.0 |
| 448 | * @access protected |
| 449 | */ |
| 450 | protected function render() { |
| 451 | |
| 452 | $settings = $this->get_settings_for_display(); |
| 453 | |
| 454 | if ( ! $settings['images'] ) { |
| 455 | return; |
| 456 | } |
| 457 | |
| 458 | $ids = wp_list_pluck( $settings['images'], 'id' ); |
| 459 | $args = array( |
| 460 | // images_section |
| 461 | 'images' => $ids, |
| 462 | |
| 463 | // display_section |
| 464 | 'arrows' => $settings['arrows'], |
| 465 | 'loop' => $settings['loop'], |
| 466 | 'slideshow' => $settings['slideshow'], |
| 467 | 'slideshow_delay' => $settings['slideshow_delay'], |
| 468 | 'add_title' => $settings['add_title'], |
| 469 | 'add_caption' => $settings['add_caption'], |
| 470 | |
| 471 | // slides_section |
| 472 | 'width' => $settings['width']['size'], |
| 473 | 'height' => $settings['height']['size'], |
| 474 | 'space' => $settings['space']['size'], |
| 475 | ); |
| 476 | |
| 477 | // get the shortcode base blog page |
| 478 | echo auxin_touch_slider_callback( $args ); |
| 479 | } |
| 480 | |
| 481 | } |
| 482 |