theme-elements
6 months ago
accordion.php
6 months ago
audio.php
6 months ago
before-after.php
6 months ago
button.php
6 months ago
carousel-navigation.php
6 months ago
circle-chart.php
6 months ago
contact-box.php
6 months ago
contact-form.php
6 months ago
custom-list.php
6 months ago
divider.php
6 months ago
gallery.php
6 months ago
gmap.php
6 months ago
heading-modern.php
6 months ago
icon.php
6 months ago
image.php
6 months ago
mailchimp.php
6 months ago
modern-button.php
6 months ago
products-grid.php
6 months ago
quote.php
6 months ago
recent-comments.php
6 months ago
recent-posts-grid-carousel.php
6 months ago
recent-posts-land-style.php
6 months ago
recent-posts-masonry.php
6 months ago
recent-posts-tiles-carousel.php
6 months ago
recent-posts-tiles.php
6 months ago
recent-posts-timeline.php
6 months ago
recent-products.php
6 months ago
responsive-table.php
6 months ago
search.php
6 months ago
staff.php
6 months ago
svg.php
6 months ago
tabs.php
6 months ago
testimonial.php
6 months ago
text.php
6 months ago
touch-slider.php
6 months ago
video.php
6 months ago
divider.php
440 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 | |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; // Exit if accessed directly. |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Elementor 'Divider' widget. |
| 15 | * |
| 16 | * Elementor widget that displays an 'Divider' with lightbox. |
| 17 | * |
| 18 | * @since 1.0.0 |
| 19 | */ |
| 20 | class Divider extends Widget_Base { |
| 21 | |
| 22 | /** |
| 23 | * Get widget name. |
| 24 | * |
| 25 | * Retrieve 'Divider' widget name. |
| 26 | * |
| 27 | * @since 1.0.0 |
| 28 | * @access public |
| 29 | * |
| 30 | * @return string Widget name. |
| 31 | */ |
| 32 | public function get_name() { |
| 33 | return 'aux_divider'; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Get widget title. |
| 38 | * |
| 39 | * Retrieve 'Divider' widget title. |
| 40 | * |
| 41 | * @since 1.0.0 |
| 42 | * @access public |
| 43 | * |
| 44 | * @return string Widget title. |
| 45 | */ |
| 46 | public function get_title() { |
| 47 | return __('Divider', 'auxin-elements' ); |
| 48 | } |
| 49 | |
| 50 | public function has_widget_inner_wrapper(): bool { |
| 51 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 52 | } |
| 53 | |
| 54 | |
| 55 | /** |
| 56 | * Get widget icon. |
| 57 | * |
| 58 | * Retrieve 'Divider' widget icon. |
| 59 | * |
| 60 | * @since 1.0.0 |
| 61 | * @access public |
| 62 | * |
| 63 | * @return string Widget icon. |
| 64 | */ |
| 65 | public function get_icon() { |
| 66 | return 'eicon-divider auxin-badge'; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Get widget categories. |
| 71 | * |
| 72 | * Retrieve 'Divider' widget icon. |
| 73 | * |
| 74 | * @since 1.0.0 |
| 75 | * @access public |
| 76 | * |
| 77 | * @return string Widget icon. |
| 78 | */ |
| 79 | public function get_categories() { |
| 80 | return array( 'auxin-core' ); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Register 'Divider' widget controls. |
| 85 | * |
| 86 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 87 | * |
| 88 | * @since 1.0.0 |
| 89 | * @access protected |
| 90 | */ |
| 91 | protected function register_controls() { |
| 92 | |
| 93 | /*-----------------------------------------------------------------------------------*/ |
| 94 | /* Divider section |
| 95 | /*-----------------------------------------------------------------------------------*/ |
| 96 | |
| 97 | $this->start_controls_section( |
| 98 | 'divider_section', |
| 99 | array( |
| 100 | 'label' => __('Divider', 'auxin-elements' ) |
| 101 | ) |
| 102 | ); |
| 103 | |
| 104 | $this->add_control( |
| 105 | 'style', |
| 106 | array( |
| 107 | 'label' => __('Style','auxin-elements' ), |
| 108 | 'type' => 'aux-visual-select', |
| 109 | 'style_items' => 'max-width:48%;', |
| 110 | 'options' => array( |
| 111 | 'white-space' => array( |
| 112 | 'label' => __('White Space', 'auxin-elements'), |
| 113 | 'image' => AUXIN_URL . 'images/visual-select/divider-white-space.svg' |
| 114 | ), |
| 115 | 'solid' => array( |
| 116 | 'label' => __('Solid', 'auxin-elements'), |
| 117 | 'image' => AUXIN_URL . 'images/visual-select/divider-solid.svg' |
| 118 | ), |
| 119 | 'dashed' => array( |
| 120 | 'label' => __('Dashed', 'auxin-elements'), |
| 121 | 'image' => AUXIN_URL . 'images/visual-select/divider-dashed.svg' |
| 122 | ), |
| 123 | 'circle-symbol' => array( |
| 124 | 'label' => __('Circle', 'auxin-elements'), |
| 125 | 'image' => AUXIN_URL . 'images/visual-select/divider-circle.svg' |
| 126 | ), |
| 127 | 'diamond-symbol' => array( |
| 128 | 'label' => __('Diamond', 'auxin-elements'), |
| 129 | 'image' => AUXIN_URL . 'images/visual-select/divider-diamond.svg' |
| 130 | ), |
| 131 | 'vertical' => array( |
| 132 | 'label' => __('Vertical Line', 'auxin-elements'), |
| 133 | 'image' => AUXIN_URL . 'images/visual-select/divider-diamond.svg' |
| 134 | ) |
| 135 | ), |
| 136 | 'default' => 'circle-symbol' |
| 137 | ) |
| 138 | ); |
| 139 | |
| 140 | $this->add_control( |
| 141 | 'width', |
| 142 | array( |
| 143 | 'label' => __('Width','auxin-elements'), |
| 144 | 'description' => __('Specifies the size of divider.', 'auxin-elements'), |
| 145 | 'label_block' => true, |
| 146 | 'type' => Controls_Manager::SELECT, |
| 147 | 'default' => 'medium', |
| 148 | 'options' => array( |
| 149 | 'large' => __('Full' , 'auxin-elements'), |
| 150 | 'medium' => __('Medium', 'auxin-elements'), |
| 151 | 'small' => __('Small' , 'auxin-elements'), |
| 152 | 'tiny' => __('Tiny' , 'auxin-elements'), |
| 153 | 'custom' => __('Custom', 'auxin-elements') |
| 154 | ), |
| 155 | 'return_value' => '', |
| 156 | 'condition' => array( |
| 157 | 'style!' => array( 'white-space', 'vertical' ) |
| 158 | ) |
| 159 | ) |
| 160 | ); |
| 161 | |
| 162 | $this->add_responsive_control( |
| 163 | 'custom_width', |
| 164 | array( |
| 165 | 'label' => __( 'Custom width', 'auxin-elements' ), |
| 166 | 'type' => Controls_Manager::SLIDER, |
| 167 | 'size_units' => array('px', '%'), |
| 168 | 'desktop_default' => array( |
| 169 | 'size' => 100, |
| 170 | 'unit' => '%' |
| 171 | ), |
| 172 | 'range' => array( |
| 173 | 'px' => array( |
| 174 | 'min' => 0, |
| 175 | 'max' => 1600, |
| 176 | 'step' => 1 |
| 177 | ), |
| 178 | '%' => array( |
| 179 | 'min' => 1, |
| 180 | 'max' => 100, |
| 181 | 'step' => 1 |
| 182 | ) |
| 183 | ), |
| 184 | 'return_value' => '', |
| 185 | 'selectors' => array( |
| 186 | '{{WRAPPER}} hr[class*="aux-divider"]' => 'width:{{SIZE}}{{UNIT}};' |
| 187 | ), |
| 188 | 'condition' => array( |
| 189 | 'style!' => array( 'white-space', 'vertical' ), |
| 190 | 'width' => 'custom' |
| 191 | ) |
| 192 | ) |
| 193 | ); |
| 194 | |
| 195 | $this->add_control( |
| 196 | 'alignment', |
| 197 | array( |
| 198 | 'label' => __('Alignment', 'auxin-elements'), |
| 199 | 'type' => Controls_Manager::CHOOSE, |
| 200 | 'default' => 'center', |
| 201 | 'options' => array( |
| 202 | 'left' => array( |
| 203 | 'title' => __( 'Left', 'auxin-elements' ), |
| 204 | 'icon' => 'eicon-text-align-left', |
| 205 | ), |
| 206 | 'center' => array( |
| 207 | 'title' => __( 'Center', 'auxin-elements' ), |
| 208 | 'icon' => 'eicon-text-align-center', |
| 209 | ), |
| 210 | 'right' => array( |
| 211 | 'title' => __( 'Right', 'auxin-elements' ), |
| 212 | 'icon' => 'eicon-text-align-right', |
| 213 | ) |
| 214 | ), |
| 215 | 'return_value' => '', |
| 216 | 'conditions' => array( |
| 217 | 'relation' => 'and', |
| 218 | 'terms' => array( |
| 219 | array( |
| 220 | 'name' => 'style', |
| 221 | 'operator' => '!==', |
| 222 | 'value' => 'white-space' |
| 223 | ), |
| 224 | array( |
| 225 | 'name' => 'width', |
| 226 | 'operator' => '!==', |
| 227 | 'value' => 'large' |
| 228 | ) |
| 229 | ) |
| 230 | ) |
| 231 | ) |
| 232 | ); |
| 233 | |
| 234 | $this->add_control( |
| 235 | 'symbol_alignment', |
| 236 | array( |
| 237 | 'label' => __('Symbol Alignment', 'auxin-elements'), |
| 238 | 'type' => Controls_Manager::CHOOSE, |
| 239 | 'default' => 'center', |
| 240 | 'options' => array( |
| 241 | 'left' => array( |
| 242 | 'title' => __( 'Left', 'auxin-elements' ), |
| 243 | 'icon' => 'eicon-text-align-left', |
| 244 | ), |
| 245 | 'center' => array( |
| 246 | 'title' => __( 'Center', 'auxin-elements' ), |
| 247 | 'icon' => 'eicon-text-align-center', |
| 248 | ), |
| 249 | 'right' => array( |
| 250 | 'title' => __( 'Right', 'auxin-elements' ), |
| 251 | 'icon' => 'eicon-text-align-right', |
| 252 | ) |
| 253 | ), |
| 254 | 'return_value' => '', |
| 255 | 'condition' => array( |
| 256 | 'style' => array( 'circle-symbol', 'diamond-symbol' ) |
| 257 | ) |
| 258 | ) |
| 259 | ); |
| 260 | |
| 261 | $this->add_responsive_control( |
| 262 | 'white_space', |
| 263 | array( |
| 264 | 'label' => __( 'Gap', 'auxin-elements' ), |
| 265 | 'type' => Controls_Manager::SLIDER, |
| 266 | 'size_units' => array('px','em', 'rem'), |
| 267 | 'desktop_default' => array( |
| 268 | 'size' => 3, |
| 269 | 'unit' => 'em' |
| 270 | ), |
| 271 | 'range' => array( |
| 272 | 'px' => array( |
| 273 | 'min' => 0, |
| 274 | 'max' => 500, |
| 275 | 'step' => 1 |
| 276 | ), |
| 277 | 'em' => array( |
| 278 | 'min' => 1, |
| 279 | 'max' => 15, |
| 280 | 'step' => 0.1 |
| 281 | ), |
| 282 | 'rem' => array( |
| 283 | 'min' => 1, |
| 284 | 'max' => 15, |
| 285 | 'step' => 0.1 |
| 286 | ) |
| 287 | ), |
| 288 | 'selectors' => array( |
| 289 | '{{WRAPPER}} hr.aux-divider-space' => 'padding-top: {{SIZE}}{{UNIT}}; margin-top:0; margin-bottom:0;' |
| 290 | ), |
| 291 | 'condition' => array( |
| 292 | 'style' => 'white-space' |
| 293 | ) |
| 294 | ) |
| 295 | ); |
| 296 | |
| 297 | $this->add_responsive_control( |
| 298 | 'margin_top', |
| 299 | array( |
| 300 | 'label' => __( 'Gap top', 'auxin-elements' ), |
| 301 | 'type' => Controls_Manager::SLIDER, |
| 302 | 'size_units' => array('px','em', 'rem'), |
| 303 | 'desktop_default' => array( |
| 304 | 'size' => 3, |
| 305 | 'unit' => 'em' |
| 306 | ), |
| 307 | 'range' => array( |
| 308 | 'px' => array( |
| 309 | 'min' => 0, |
| 310 | 'max' => 500, |
| 311 | 'step' => 1 |
| 312 | ), |
| 313 | 'em' => array( |
| 314 | 'min' => 1, |
| 315 | 'max' => 15, |
| 316 | 'step' => 0.1 |
| 317 | ), |
| 318 | 'rem' => array( |
| 319 | 'min' => 1, |
| 320 | 'max' => 15, |
| 321 | 'step' => 0.1 |
| 322 | ) |
| 323 | ), |
| 324 | 'selectors' => array( |
| 325 | '{{WRAPPER}} hr[class*="aux-divider"]' => 'margin-top:{{SIZE}}{{UNIT}};' |
| 326 | ), |
| 327 | 'condition' => array( |
| 328 | 'style!' => 'white-space' |
| 329 | ) |
| 330 | ) |
| 331 | ); |
| 332 | |
| 333 | $this->add_responsive_control( |
| 334 | 'margin_bottom', |
| 335 | array( |
| 336 | 'label' => __( 'Gap bottom', 'auxin-elements' ), |
| 337 | 'type' => Controls_Manager::SLIDER, |
| 338 | 'size_units' => array('px','em', 'rem'), |
| 339 | 'desktop_default' => array( |
| 340 | 'size' => 3, |
| 341 | 'unit' => 'em' |
| 342 | ), |
| 343 | 'range' => array( |
| 344 | 'px' => array( |
| 345 | 'min' => 0, |
| 346 | 'max' => 500, |
| 347 | 'step' => 1 |
| 348 | ), |
| 349 | 'em' => array( |
| 350 | 'min' => 1, |
| 351 | 'max' => 15, |
| 352 | 'step' => 0.1 |
| 353 | ), |
| 354 | 'rem' => array( |
| 355 | 'min' => 1, |
| 356 | 'max' => 15, |
| 357 | 'step' => 0.1 |
| 358 | ) |
| 359 | ), |
| 360 | 'selectors' => array( |
| 361 | '{{WRAPPER}} hr[class*="aux-divider"]' => 'margin-bottom:{{SIZE}}{{UNIT}};' |
| 362 | ), |
| 363 | 'condition' => array( |
| 364 | 'style!' => 'white-space' |
| 365 | ) |
| 366 | ) |
| 367 | ); |
| 368 | |
| 369 | $this->end_controls_section(); |
| 370 | |
| 371 | /*-----------------------------------------------------------------------------------*/ |
| 372 | /* Style Tab |
| 373 | /*-----------------------------------------------------------------------------------*/ |
| 374 | |
| 375 | /* Color Section |
| 376 | /*-------------------------------------*/ |
| 377 | |
| 378 | $this->start_controls_section( |
| 379 | 'color_section', |
| 380 | array( |
| 381 | 'label' => __( 'Color', 'auxin-elements' ), |
| 382 | 'tab' => Controls_Manager::TAB_STYLE, |
| 383 | 'condition' => array( |
| 384 | 'style!' => 'white-space' |
| 385 | ) |
| 386 | ) |
| 387 | ); |
| 388 | |
| 389 | $this->add_control( |
| 390 | 'divider_color', |
| 391 | array( |
| 392 | 'label' => __( 'Divider color', 'auxin-elements' ), |
| 393 | 'type' => Controls_Manager::COLOR, |
| 394 | 'selectors' => array( |
| 395 | '{{WRAPPER}} hr[class*="aux-divider"]' => 'border-color: {{VALUE}};' |
| 396 | ), |
| 397 | 'return_value' => '' |
| 398 | ) |
| 399 | ); |
| 400 | |
| 401 | $this->add_control( |
| 402 | 'symbol_color', |
| 403 | array( |
| 404 | 'label' => __( 'Symbol color', 'auxin-elements' ), |
| 405 | 'type' => Controls_Manager::COLOR, |
| 406 | 'selectors' => array( |
| 407 | '{{WRAPPER}} .aux-divider-symbolic-circle:after' => 'border-color: {{VALUE}};', |
| 408 | '{{WRAPPER}} .aux-divider-symbolic-square:after' => 'background-color: {{VALUE}};' |
| 409 | ), |
| 410 | 'condition' => array( |
| 411 | 'style!' => array( 'white-space', 'vertical' ) |
| 412 | ) |
| 413 | ) |
| 414 | ); |
| 415 | |
| 416 | $this->end_controls_section(); |
| 417 | } |
| 418 | |
| 419 | /** |
| 420 | * Render 'Divider' widget output on the frontend. |
| 421 | * |
| 422 | * @access protected |
| 423 | */ |
| 424 | protected function render() { |
| 425 | |
| 426 | $settings = $this->get_settings_for_display(); |
| 427 | |
| 428 | $args = array( |
| 429 | 'width' => $settings['width'], |
| 430 | 'alignment' => $settings['alignment'], |
| 431 | 'symbol_alignment' => $settings['symbol_alignment'], |
| 432 | 'style' => $settings['style'] |
| 433 | ); |
| 434 | |
| 435 | // pass the args through the corresponding shortcode callback |
| 436 | echo auxin_widget_divider_callback( $args ); |
| 437 | } |
| 438 | |
| 439 | } |
| 440 |