| @@ -5,10 +5,10 @@ | ||
| 5 | 5 | use Elementor\Controls_Manager; |
| 6 | 6 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 7 | 7 | use Elementor\Group_Control_Typography; |
| 8 | 8 | use Elementor\Modules\Shapes\Module as Shapes_Module; |
| 9 | +use Elementor\Utils; | |
| 9 | 10 | use Elementor\Group_Control_Text_Stroke; |
| 10 | -use Elementor\Plugin; | |
| 11 | 11 | use Elementor\Widget_Base; |
| 12 | 12 | |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 14 | exit; // Exit if accessed directly. |
| @@ -17,8 +17,9 @@ | ||
| 17 | 17 | /** |
| 18 | 18 | * Elementor WordArt widget. |
| 19 | 19 | * |
| 20 | 20 | * Elementor widget that displays text along SVG path. |
| 21 | + * | |
| 21 | 22 | */ |
| 22 | 23 | class TextPath extends Widget_Base { |
| 23 | 24 | |
| 24 | 25 | const DEFAULT_PATH_FILL = '#E8178A'; |
| @@ -29,17 +30,14 @@ | ||
| 29 | 30 | * Retrieve Text Path widget name. |
| 30 | 31 | * |
| 31 | 32 | * @return string Widget name. |
| 32 | 33 | * @access public |
| 34 | + * | |
| 33 | 35 | */ |
| 34 | 36 | public function get_name() { |
| 35 | 37 | return 'text-path'; |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | - public function get_group_name() { | |
| 39 | - return 'shapes'; | |
| 40 | - } | |
| 41 | - | |
| 42 | 40 | /** |
| 43 | 41 | * Get widget title. |
| 44 | 42 | * |
| 45 | 43 | * Retrieve Text Path widget title. |
| @@ -45,8 +43,9 @@ | ||
| 45 | 43 | * Retrieve Text Path widget title. |
| 46 | 44 | * |
| 47 | 45 | * @return string Widget title. |
| 48 | 46 | * @access public |
| 47 | + * | |
| 49 | 48 | */ |
| 50 | 49 | public function get_title() { |
| 51 | 50 | return esc_html__( 'Text Path', 'elementor' ); |
| 52 | 51 | } |
| @@ -57,8 +56,9 @@ | ||
| 57 | 56 | * Retrieve Text Path widget icon. |
| 58 | 57 | * |
| 59 | 58 | * @return string Widget icon. |
| 60 | 59 | * @access public |
| 60 | + * | |
| 61 | 61 | */ |
| 62 | 62 | public function get_icon() { |
| 63 | 63 | return 'eicon-wordart'; |
| 64 | 64 | } |
| @@ -69,8 +69,9 @@ | ||
| 69 | 69 | * Retrieve the list of keywords the widget belongs to. |
| 70 | 70 | * |
| 71 | 71 | * @return array Widget keywords. |
| 72 | 72 | * @access public |
| 73 | + * | |
| 73 | 74 | */ |
| 74 | 75 | public function get_keywords() { |
| 75 | 76 | return [ 'text path', 'word path', 'text on path', 'wordart', 'word art' ]; |
| 76 | 77 | } |
| @@ -75,26 +76,8 @@ | ||
| 75 | 76 | return [ 'text path', 'word path', 'text on path', 'wordart', 'word art' ]; |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | /** |
| 79 | - * Get style dependencies. | |
| 80 | - * | |
| 81 | - * Retrieve the list of style dependencies the widget requires. | |
| 82 | - * | |
| 83 | - * @since 3.24.0 | |
| 84 | - * @access public | |
| 85 | - * | |
| 86 | - * @return array Widget style dependencies. | |
| 87 | - */ | |
| 88 | - public function get_style_depends(): array { | |
| 89 | - return [ 'widget-text-path' ]; | |
| 90 | - } | |
| 91 | - | |
| 92 | - public function has_widget_inner_wrapper(): bool { | |
| 93 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 94 | - } | |
| 95 | - | |
| 96 | - /** | |
| 97 | 80 | * Register content controls under content tab. |
| 98 | 81 | */ |
| 99 | 82 | protected function register_content_tab() { |
| 100 | 83 | $this->start_controls_section( |
| @@ -144,11 +127,12 @@ | ||
| 144 | 127 | 'dynamic' => [ |
| 145 | 128 | 'active' => true, |
| 146 | 129 | ], |
| 147 | 130 | 'description' => sprintf( |
| 148 | - '%1$s <a target="_blank" href="https://go.elementor.com/text-path-create-paths/">%2$s</a>', | |
| 149 | - esc_html__( 'Want to create custom text paths with SVG?', 'elementor' ), | |
| 150 | - esc_html__( 'Learn more', 'elementor' ) | |
| 131 | + /* translators: 1: Link open tag, 2: Link close tag. */ | |
| 132 | + esc_html__( 'Want to create custom text paths with SVG? %1$sLearn More%2$s', 'elementor' ), | |
| 133 | + '<a target="_blank" href="https://go.elementor.com/text-path-create-paths/">', | |
| 134 | + '</a>' | |
| 151 | 135 | ), |
| 152 | 136 | ] |
| 153 | 137 | ); |
| 154 | 138 | |
| @@ -257,8 +241,9 @@ | ||
| 257 | 241 | 'max' => 100, |
| 258 | 242 | 'step' => 10, |
| 259 | 243 | ], |
| 260 | 244 | 'px' => [ |
| 245 | + 'min' => 0, | |
| 261 | 246 | 'max' => 800, |
| 262 | 247 | 'step' => 50, |
| 263 | 248 | ], |
| 264 | 249 | ], |
| @@ -350,17 +335,15 @@ | ||
| 350 | 335 | 'range' => [ |
| 351 | 336 | 'px' => [ |
| 352 | 337 | 'min' => -20, |
| 353 | 338 | 'max' => 20, |
| 339 | + 'step' => 1, | |
| 354 | 340 | ], |
| 355 | 341 | 'em' => [ |
| 356 | 342 | 'min' => -1, |
| 357 | 343 | 'max' => 1, |
| 344 | + 'step' => 0.1, | |
| 358 | 345 | ], |
| 359 | - 'rem' => [ | |
| 360 | - 'min' => -1, | |
| 361 | - 'max' => 1, | |
| 362 | - ], | |
| 363 | 346 | ], |
| 364 | 347 | 'default' => [ |
| 365 | 348 | 'size' => '', |
| 366 | 349 | ], |
| @@ -378,9 +361,9 @@ | ||
| 378 | 361 | |
| 379 | 362 | $this->add_control( |
| 380 | 363 | 'start_point', |
| 381 | 364 | [ |
| 382 | - 'label' => esc_html__( 'Starting Point', 'elementor' ) . ' (%)', | |
| 365 | + 'label' => esc_html__( 'Starting Point', 'elementor' ), | |
| 383 | 366 | 'type' => Controls_Manager::SLIDER, |
| 384 | 367 | 'size_units' => [ '%' ], |
| 385 | 368 | 'range' => [ |
| 386 | 369 | 'px' => [ |
| @@ -538,23 +521,17 @@ | ||
| 538 | 521 | 'stroke_width_normal', |
| 539 | 522 | [ |
| 540 | 523 | 'label' => esc_html__( 'Width', 'elementor' ), |
| 541 | 524 | 'type' => Controls_Manager::SLIDER, |
| 542 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 543 | 525 | 'default' => [ |
| 544 | 526 | 'size' => 1, |
| 545 | 527 | ], |
| 546 | 528 | 'range' => [ |
| 547 | 529 | 'px' => [ |
| 548 | - 'min' => 1, | |
| 530 | + 'min' => 0, | |
| 549 | 531 | 'max' => 20, |
| 532 | + 'step' => 1, | |
| 550 | 533 | ], |
| 551 | - 'em' => [ | |
| 552 | - 'max' => 2, | |
| 553 | - ], | |
| 554 | - 'rem' => [ | |
| 555 | - 'max' => 2, | |
| 556 | - ], | |
| 557 | 534 | ], |
| 558 | 535 | 'selectors' => [ |
| 559 | 536 | '{{WRAPPER}}' => '--stroke-width: {{SIZE}}{{UNIT}}', |
| 560 | 537 | ], |
| @@ -609,23 +586,17 @@ | ||
| 609 | 586 | 'stroke_width_hover', |
| 610 | 587 | [ |
| 611 | 588 | 'label' => esc_html__( 'Width', 'elementor' ), |
| 612 | 589 | 'type' => Controls_Manager::SLIDER, |
| 613 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 614 | 590 | 'default' => [ |
| 615 | 591 | 'size' => '', |
| 616 | 592 | ], |
| 617 | 593 | 'range' => [ |
| 618 | 594 | 'px' => [ |
| 619 | - 'min' => 1, | |
| 595 | + 'min' => 0, | |
| 620 | 596 | 'max' => 20, |
| 597 | + 'step' => 1, | |
| 621 | 598 | ], |
| 622 | - 'em' => [ | |
| 623 | - 'max' => 2, | |
| 624 | - ], | |
| 625 | - 'rem' => [ | |
| 626 | - 'max' => 2, | |
| 627 | - ], | |
| 628 | 599 | ], |
| 629 | 600 | 'selectors' => [ |
| 630 | 601 | '{{WRAPPER}}' => '--stroke-width-hover: {{SIZE}}{{UNIT}}', |
| 631 | 602 | ], |
| @@ -687,9 +658,9 @@ | ||
| 687 | 658 | |
| 688 | 659 | // Add Text Path attributes. |
| 689 | 660 | $this->add_render_attribute( 'text_path', [ |
| 690 | 661 | 'class' => 'e-text-path', |
| 691 | - 'data-text' => htmlentities( esc_attr( $settings['text'] ) ), | |
| 662 | + 'data-text' => esc_attr( $settings['text'] ), | |
| 692 | 663 | 'data-url' => esc_url( $path_url ), |
| 693 | 664 | 'data-link-url' => esc_url( $settings['link']['url'] ?? '' ), |
| 694 | 665 | ] ); |
| 695 | 666 | |