| @@ -117,8 +117,11 @@ | ||
| 117 | 117 | * @since 3.1.0 |
| 118 | 118 | * @access protected |
| 119 | 119 | */ |
| 120 | 120 | protected function register_controls() { |
| 121 | + $start = is_rtl() ? 'right' : 'left'; | |
| 122 | + $end = ! is_rtl() ? 'right' : 'left'; | |
| 123 | + | |
| 121 | 124 | $this->start_controls_section( |
| 122 | 125 | 'section_counter', |
| 123 | 126 | [ |
| 124 | 127 | 'label' => esc_html__( 'Counter', 'elementor' ), |
| @@ -279,15 +282,16 @@ | ||
| 279 | 282 | 'after' => [ |
| 280 | 283 | 'title' => esc_html__( 'After', 'elementor' ), |
| 281 | 284 | 'icon' => 'eicon-v-align-bottom', |
| 282 | 285 | ], |
| 286 | + | |
| 283 | 287 | 'start' => [ |
| 284 | 288 | 'title' => esc_html__( 'Start', 'elementor' ), |
| 285 | - 'icon' => 'eicon-h-align-left', | |
| 289 | + 'icon' => "eicon-h-align-$start", | |
| 286 | 290 | ], |
| 287 | 291 | 'end' => [ |
| 288 | 292 | 'title' => esc_html__( 'End', 'elementor' ), |
| 289 | - 'icon' => 'eicon-h-align-right', | |
| 293 | + 'icon' => "eicon-h-align-$end", | |
| 290 | 294 | ], |
| 291 | 295 | ], |
| 292 | 296 | 'selectors_dictionary' => [ |
| 293 | 297 | 'before' => 'flex-direction: column;', |
| @@ -297,9 +301,8 @@ | ||
| 297 | 301 | ], |
| 298 | 302 | 'selectors' => [ |
| 299 | 303 | '{{WRAPPER}} .elementor-counter' => '{{VALUE}}', |
| 300 | 304 | ], |
| 301 | - 'classes' => 'elementor-control-start-end', | |
| 302 | 305 | 'condition' => [ |
| 303 | 306 | 'title!' => '', |
| 304 | 307 | ], |
| 305 | 308 | ] |
| @@ -312,9 +315,9 @@ | ||
| 312 | 315 | 'type' => Controls_Manager::CHOOSE, |
| 313 | 316 | 'options' => [ |
| 314 | 317 | 'start' => [ |
| 315 | 318 | 'title' => esc_html__( 'Start', 'elementor' ), |
| 316 | - 'icon' => 'eicon-h-align-left', | |
| 319 | + 'icon' => "eicon-h-align-$start", | |
| 317 | 320 | ], |
| 318 | 321 | 'center' => [ |
| 319 | 322 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 320 | 323 | 'icon' => 'eicon-h-align-center', |
| @@ -320,13 +323,12 @@ | ||
| 320 | 323 | 'icon' => 'eicon-h-align-center', |
| 321 | 324 | ], |
| 322 | 325 | 'end' => [ |
| 323 | 326 | 'title' => esc_html__( 'End', 'elementor' ), |
| 324 | - 'icon' => 'eicon-h-align-right', | |
| 327 | + 'icon' => "eicon-h-align-$end", | |
| 325 | 328 | ], |
| 326 | 329 | ], |
| 327 | 330 | 'separator' => 'before', |
| 328 | - 'classes' => 'elementor-control-start-end', | |
| 329 | 331 | 'selectors' => [ |
| 330 | 332 | '{{WRAPPER}} .elementor-counter-title' => 'justify-content: {{VALUE}};', |
| 331 | 333 | ], |
| 332 | 334 | 'condition' => [ |
| @@ -387,9 +389,9 @@ | ||
| 387 | 389 | 'type' => Controls_Manager::CHOOSE, |
| 388 | 390 | 'options' => [ |
| 389 | 391 | 'start' => [ |
| 390 | 392 | 'title' => esc_html__( 'Start', 'elementor' ), |
| 391 | - 'icon' => 'eicon-h-align-left', | |
| 393 | + 'icon' => "eicon-h-align-$start", | |
| 392 | 394 | ], |
| 393 | 395 | 'center' => [ |
| 394 | 396 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 395 | 397 | 'icon' => 'eicon-h-align-center', |
| @@ -395,9 +397,9 @@ | ||
| 395 | 397 | 'icon' => 'eicon-h-align-center', |
| 396 | 398 | ], |
| 397 | 399 | 'end' => [ |
| 398 | 400 | 'title' => esc_html__( 'End', 'elementor' ), |
| 399 | - 'icon' => 'eicon-h-align-right', | |
| 401 | + 'icon' => "eicon-h-align-$end", | |
| 400 | 402 | ], |
| 401 | 403 | 'stretch' => [ |
| 402 | 404 | 'title' => esc_html__( 'Stretch', 'elementor' ), |
| 403 | 405 | 'icon' => 'eicon-grow', |
| @@ -402,9 +404,8 @@ | ||
| 402 | 404 | 'title' => esc_html__( 'Stretch', 'elementor' ), |
| 403 | 405 | 'icon' => 'eicon-grow', |
| 404 | 406 | ], |
| 405 | 407 | ], |
| 406 | - 'classes' => 'elementor-control-start-end', | |
| 407 | 408 | 'selectors_dictionary' => [ |
| 408 | 409 | 'start' => 'text-align: {{VALUE}}; --counter-prefix-grow: 0; --counter-suffix-grow: 1; --counter-number-grow: 0;', |
| 409 | 410 | 'center' => 'text-align: {{VALUE}}; --counter-prefix-grow: 1; --counter-suffix-grow: 1; --counter-number-grow: 0;', |
| 410 | 411 | 'end' => 'text-align: {{VALUE}}; --counter-prefix-grow: 1; --counter-suffix-grow: 0; --counter-number-grow: 0;', |
| @@ -424,9 +425,9 @@ | ||
| 424 | 425 | 'type' => Controls_Manager::CHOOSE, |
| 425 | 426 | 'options' => [ |
| 426 | 427 | 'start' => [ |
| 427 | 428 | 'title' => esc_html__( 'Start', 'elementor' ), |
| 428 | - 'icon' => 'eicon-text-align-left', | |
| 429 | + 'icon' => "eicon-text-align-$start", | |
| 429 | 430 | ], |
| 430 | 431 | 'center' => [ |
| 431 | 432 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 432 | 433 | 'icon' => 'eicon-text-align-center', |
| @@ -432,12 +433,11 @@ | ||
| 432 | 433 | 'icon' => 'eicon-text-align-center', |
| 433 | 434 | ], |
| 434 | 435 | 'end' => [ |
| 435 | 436 | 'title' => esc_html__( 'End', 'elementor' ), |
| 436 | - 'icon' => 'eicon-text-align-right', | |
| 437 | + 'icon' => "eicon-text-align-$end", | |
| 437 | 438 | ], |
| 438 | 439 | ], |
| 439 | - 'classes' => 'elementor-control-start-end', | |
| 440 | 440 | 'selectors' => [ |
| 441 | 441 | '{{WRAPPER}} .elementor-counter-number' => 'text-align: {{VALUE}};', |
| 442 | 442 | ], |
| 443 | 443 | 'condition' => [ |
| @@ -647,11 +647,11 @@ | ||
| 647 | 647 | <# if ( settings.title ) { |
| 648 | 648 | #><{{ titleTag }} {{{ view.getRenderAttributeString( 'counter-title' ) }}}>{{{ elementor.helpers.sanitize( settings.title, { ALLOW_DATA_ATTR: false } ) }}}</{{ titleTag }}><# |
| 649 | 649 | } #> |
| 650 | 650 | <div {{{ view.getRenderAttributeString( 'counter-number' ) }}}> |
| 651 | - <span {{{ view.getRenderAttributeString( 'prefix' ) }}}>{{ settings.prefix }}</span> | |
| 652 | - <span {{{ view.getRenderAttributeString( 'counter' ) }}}>{{ settings.starting_number }}</span> | |
| 653 | - <span {{{ view.getRenderAttributeString( 'suffix' ) }}}>{{ settings.suffix }}</span> | |
| 651 | + <span {{{ view.getRenderAttributeString( 'prefix' ) }}}>{{{ settings.prefix }}}</span> | |
| 652 | + <span {{{ view.getRenderAttributeString( 'counter' ) }}}>{{{ settings.starting_number }}}</span> | |
| 653 | + <span {{{ view.getRenderAttributeString( 'suffix' ) }}}>{{{ settings.suffix }}}</span> | |
| 654 | 654 | </div> |
| 655 | 655 | </div> |
| 656 | 656 | <?php |
| 657 | 657 | } |
| @@ -702,26 +702,12 @@ | ||
| 702 | 702 | ?><<?php Utils::print_validated_html_tag( $title_tag ); ?> <?php $this->print_render_attribute_string( 'counter-title' ); ?>><?php echo wp_kses_post( $this->get_settings_for_display( 'title' ) ); ?></<?php Utils::print_validated_html_tag( $title_tag ); ?>><?php |
| 703 | 703 | endif; |
| 704 | 704 | ?> |
| 705 | 705 | <div <?php $this->print_render_attribute_string( 'counter-number' ); ?>> |
| 706 | - <span <?php $this->print_render_attribute_string( 'prefix' ); ?>><?php echo wp_kses_post( $settings['prefix'] ); ?></span> | |
| 707 | - <span <?php $this->print_render_attribute_string( 'counter' ); ?>><?php echo wp_kses_post( $settings['starting_number'] ); ?></span> | |
| 708 | - <span <?php $this->print_render_attribute_string( 'suffix' ); ?>><?php echo wp_kses_post( $settings['suffix'] ); ?></span> | |
| 706 | + <span <?php $this->print_render_attribute_string( 'prefix' ); ?>><?php $this->print_unescaped_setting( 'prefix' ); ?></span> | |
| 707 | + <span <?php $this->print_render_attribute_string( 'counter' ); ?>><?php $this->print_unescaped_setting( 'starting_number' ); ?></span> | |
| 708 | + <span <?php $this->print_render_attribute_string( 'suffix' ); ?>><?php $this->print_unescaped_setting( 'suffix' ); ?></span> | |
| 709 | 709 | </div> |
| 710 | 710 | </div> |
| 711 | 711 | <?php |
| 712 | - } | |
| 713 | - | |
| 714 | - public function render_markdown(): string { | |
| 715 | - $settings = $this->get_settings_for_display(); | |
| 716 | - $number = $settings['ending_number'] ?? ''; | |
| 717 | - $prefix = $settings['prefix'] ?? ''; | |
| 718 | - $suffix = $settings['suffix'] ?? ''; | |
| 719 | - $title = Utils::html_to_plain_text( $settings['title'] ?? '' ); | |
| 720 | - $value = $prefix . $number . $suffix; | |
| 721 | - if ( empty( $value ) && empty( $title ) ) { | |
| 722 | - return ''; | |
| 723 | - } | |
| 724 | - $parts = array_filter( [ $value, $title ] ); | |
| 725 | - return implode( ' - ', $parts ); | |
| 726 | 712 | } |
| 727 | 713 | } |