| @@ -5,10 +5,9 @@ | ||
| 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\Group_Control_Text_Stroke; | |
| 10 | -use Elementor\Plugin; | |
| 9 | +use Elementor\Utils; | |
| 11 | 10 | use Elementor\Widget_Base; |
| 12 | 11 | |
| 13 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 13 | exit; // Exit if accessed directly. |
| @@ -17,8 +16,9 @@ | ||
| 17 | 16 | /** |
| 18 | 17 | * Elementor WordArt widget. |
| 19 | 18 | * |
| 20 | 19 | * Elementor widget that displays text along SVG path. |
| 20 | + * | |
| 21 | 21 | */ |
| 22 | 22 | class TextPath extends Widget_Base { |
| 23 | 23 | |
| 24 | 24 | const DEFAULT_PATH_FILL = '#E8178A'; |
| @@ -29,17 +29,14 @@ | ||
| 29 | 29 | * Retrieve Text Path widget name. |
| 30 | 30 | * |
| 31 | 31 | * @return string Widget name. |
| 32 | 32 | * @access public |
| 33 | + * | |
| 33 | 34 | */ |
| 34 | 35 | public function get_name() { |
| 35 | 36 | return 'text-path'; |
| 36 | 37 | } |
| 37 | 38 | |
| 38 | - public function get_group_name() { | |
| 39 | - return 'shapes'; | |
| 40 | - } | |
| 41 | - | |
| 42 | 39 | /** |
| 43 | 40 | * Get widget title. |
| 44 | 41 | * |
| 45 | 42 | * Retrieve Text Path widget title. |
| @@ -45,11 +42,12 @@ | ||
| 45 | 42 | * Retrieve Text Path widget title. |
| 46 | 43 | * |
| 47 | 44 | * @return string Widget title. |
| 48 | 45 | * @access public |
| 46 | + * | |
| 49 | 47 | */ |
| 50 | 48 | public function get_title() { |
| 51 | - return esc_html__( 'Text Path', 'elementor' ); | |
| 49 | + return __( 'Text Path', 'elementor' ); | |
| 52 | 50 | } |
| 53 | 51 | |
| 54 | 52 | /** |
| 55 | 53 | * Get widget icon. |
| @@ -57,8 +55,9 @@ | ||
| 57 | 55 | * Retrieve Text Path widget icon. |
| 58 | 56 | * |
| 59 | 57 | * @return string Widget icon. |
| 60 | 58 | * @access public |
| 59 | + * | |
| 61 | 60 | */ |
| 62 | 61 | public function get_icon() { |
| 63 | 62 | return 'eicon-wordart'; |
| 64 | 63 | } |
| @@ -69,8 +68,9 @@ | ||
| 69 | 68 | * Retrieve the list of keywords the widget belongs to. |
| 70 | 69 | * |
| 71 | 70 | * @return array Widget keywords. |
| 72 | 71 | * @access public |
| 72 | + * | |
| 73 | 73 | */ |
| 74 | 74 | public function get_keywords() { |
| 75 | 75 | return [ 'text path', 'word path', 'text on path', 'wordart', 'word art' ]; |
| 76 | 76 | } |
| @@ -75,26 +75,8 @@ | ||
| 75 | 75 | return [ 'text path', 'word path', 'text on path', 'wordart', 'word art' ]; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 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 | 79 | * Register content controls under content tab. |
| 98 | 80 | */ |
| 99 | 81 | protected function register_content_tab() { |
| 100 | 82 | $this->start_controls_section( |
| @@ -99,9 +81,9 @@ | ||
| 99 | 81 | protected function register_content_tab() { |
| 100 | 82 | $this->start_controls_section( |
| 101 | 83 | 'section_content_text_path', |
| 102 | 84 | [ |
| 103 | - 'label' => esc_html__( 'Text Path', 'elementor' ), | |
| 85 | + 'label' => __( 'Text Path', 'elementor' ), | |
| 104 | 86 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 105 | 87 | ] |
| 106 | 88 | ); |
| 107 | 89 | |
| @@ -107,12 +89,12 @@ | ||
| 107 | 89 | |
| 108 | 90 | $this->add_control( |
| 109 | 91 | 'text', |
| 110 | 92 | [ |
| 111 | - 'label' => esc_html__( 'Text', 'elementor' ), | |
| 93 | + 'label' => __( 'Text', 'elementor' ), | |
| 112 | 94 | 'type' => Controls_Manager::TEXT, |
| 113 | 95 | 'label_block' => true, |
| 114 | - 'default' => esc_html__( 'Add Your Curvy Text Here', 'elementor' ), | |
| 96 | + 'default' => __( 'Add Your Curvy Text Here', 'elementor' ), | |
| 115 | 97 | 'frontend_available' => true, |
| 116 | 98 | 'render_type' => 'none', |
| 117 | 99 | 'dynamic' => [ |
| 118 | 100 | 'active' => true, |
| @@ -122,9 +104,9 @@ | ||
| 122 | 104 | |
| 123 | 105 | $this->add_control( |
| 124 | 106 | 'path', |
| 125 | 107 | [ |
| 126 | - 'label' => esc_html__( 'Path Type', 'elementor' ), | |
| 108 | + 'label' => __( 'Path Type', 'elementor' ), | |
| 127 | 109 | 'type' => Controls_Manager::SELECT, |
| 128 | 110 | 'options' => Shapes_Module::get_paths(), |
| 129 | 111 | 'default' => 'wave', |
| 130 | 112 | ] |
| @@ -132,9 +114,9 @@ | ||
| 132 | 114 | |
| 133 | 115 | $this->add_control( |
| 134 | 116 | 'custom_path', |
| 135 | 117 | [ |
| 136 | - 'label' => esc_html__( 'SVG', 'elementor' ), | |
| 118 | + 'label' => __( 'SVG', 'elementor' ), | |
| 137 | 119 | 'type' => Controls_Manager::MEDIA, |
| 138 | 120 | 'media_types' => [ |
| 139 | 121 | 'svg', |
| 140 | 122 | ], |
| @@ -143,13 +125,9 @@ | ||
| 143 | 125 | ], |
| 144 | 126 | 'dynamic' => [ |
| 145 | 127 | 'active' => true, |
| 146 | 128 | ], |
| 147 | - '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' ) | |
| 151 | - ), | |
| 129 | + 'description' => sprintf( __( 'Want to create custom text paths with SVG? <a target="_blank" href="%s">Learn More</a>', 'elementor' ), 'https://go.elementor.com/text-path-create-paths' ), | |
| 152 | 130 | ] |
| 153 | 131 | ); |
| 154 | 132 | |
| 155 | 133 | $this->add_control( |
| @@ -154,15 +132,15 @@ | ||
| 154 | 132 | |
| 155 | 133 | $this->add_control( |
| 156 | 134 | 'link', |
| 157 | 135 | [ |
| 158 | - 'label' => esc_html__( 'Link', 'elementor' ), | |
| 136 | + 'label' => __( 'Link', 'elementor' ), | |
| 159 | 137 | 'type' => Controls_Manager::URL, |
| 160 | 138 | 'label_block' => true, |
| 161 | 139 | 'dynamic' => [ |
| 162 | 140 | 'active' => true, |
| 163 | 141 | ], |
| 164 | - 'placeholder' => esc_html__( 'Paste URL or type', 'elementor' ), | |
| 142 | + 'placeholder' => __( 'Paste URL or type', 'elementor' ), | |
| 165 | 143 | 'frontend_available' => true, |
| 166 | 144 | ] |
| 167 | 145 | ); |
| 168 | 146 | |
| @@ -168,22 +146,22 @@ | ||
| 168 | 146 | |
| 169 | 147 | $this->add_responsive_control( |
| 170 | 148 | 'align', |
| 171 | 149 | [ |
| 172 | - 'label' => esc_html__( 'Alignment', 'elementor' ), | |
| 150 | + 'label' => __( 'Alignment', 'elementor' ), | |
| 173 | 151 | 'type' => Controls_Manager::CHOOSE, |
| 174 | 152 | 'default' => '', |
| 175 | 153 | 'options' => [ |
| 176 | 154 | 'left' => [ |
| 177 | - 'title' => esc_html__( 'Left', 'elementor' ), | |
| 155 | + 'title' => __( 'Left', 'elementor' ), | |
| 178 | 156 | 'icon' => 'eicon-text-align-left', |
| 179 | 157 | ], |
| 180 | 158 | 'center' => [ |
| 181 | - 'title' => esc_html__( 'Center', 'elementor' ), | |
| 159 | + 'title' => __( 'Center', 'elementor' ), | |
| 182 | 160 | 'icon' => 'eicon-text-align-center', |
| 183 | 161 | ], |
| 184 | 162 | 'right' => [ |
| 185 | - 'title' => esc_html__( 'Right', 'elementor' ), | |
| 163 | + 'title' => __( 'Right', 'elementor' ), | |
| 186 | 164 | 'icon' => 'eicon-text-align-right', |
| 187 | 165 | ], |
| 188 | 166 | ], |
| 189 | 167 | 'selectors' => [ |
| @@ -195,15 +173,15 @@ | ||
| 195 | 173 | |
| 196 | 174 | $this->add_control( |
| 197 | 175 | 'text_path_direction', |
| 198 | 176 | [ |
| 199 | - 'label' => esc_html__( 'Text Direction', 'elementor' ), | |
| 177 | + 'label' => __( 'Text Direction', 'elementor' ), | |
| 200 | 178 | 'type' => Controls_Manager::SELECT, |
| 201 | 179 | 'default' => '', |
| 202 | 180 | 'options' => [ |
| 203 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 204 | - 'rtl' => esc_html__( 'RTL', 'elementor' ), | |
| 205 | - 'ltr' => esc_html__( 'LTR', 'elementor' ), | |
| 181 | + '' => __( 'Default', 'elementor' ), | |
| 182 | + 'rtl' => __( 'RTL', 'elementor' ), | |
| 183 | + 'ltr' => __( 'LTR', 'elementor' ), | |
| 206 | 184 | ], |
| 207 | 185 | 'selectors' => [ |
| 208 | 186 | '{{WRAPPER}}' => '--direction: {{VALUE}}', |
| 209 | 187 | ], |
| @@ -213,12 +191,12 @@ | ||
| 213 | 191 | |
| 214 | 192 | $this->add_control( |
| 215 | 193 | 'show_path', |
| 216 | 194 | [ |
| 217 | - 'label' => esc_html__( 'Show Path', 'elementor' ), | |
| 195 | + 'label' => __( 'Show Path', 'elementor' ), | |
| 218 | 196 | 'type' => Controls_Manager::SWITCHER, |
| 219 | - 'label_on' => esc_html__( 'On', 'elementor' ), | |
| 220 | - 'label_off' => esc_html__( 'Off', 'elementor' ), | |
| 197 | + 'label_on' => __( 'On', 'elementor' ), | |
| 198 | + 'label_off' => __( 'Off', 'elementor' ), | |
| 221 | 199 | 'return_value' => self::DEFAULT_PATH_FILL, |
| 222 | 200 | 'separator' => 'before', |
| 223 | 201 | 'default' => '', |
| 224 | 202 | 'selectors' => [ |
| @@ -239,9 +217,9 @@ | ||
| 239 | 217 | */ |
| 240 | 218 | $this->start_controls_section( |
| 241 | 219 | 'section_style_text_path', |
| 242 | 220 | [ |
| 243 | - 'label' => esc_html__( 'Text Path', 'elementor' ), | |
| 221 | + 'label' => __( 'Text Path', 'elementor' ), | |
| 244 | 222 | 'tab' => Controls_Manager::TAB_STYLE, |
| 245 | 223 | ] |
| 246 | 224 | ); |
| 247 | 225 | |
| @@ -247,11 +225,11 @@ | ||
| 247 | 225 | |
| 248 | 226 | $this->add_responsive_control( |
| 249 | 227 | 'size', |
| 250 | 228 | [ |
| 251 | - 'label' => esc_html__( 'Size', 'elementor' ), | |
| 229 | + 'label' => __( 'Size', 'elementor' ), | |
| 252 | 230 | 'type' => Controls_Manager::SLIDER, |
| 253 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 231 | + 'size_units' => [ '%', 'px' ], | |
| 254 | 232 | 'range' => [ |
| 255 | 233 | '%' => [ |
| 256 | 234 | 'min' => 0, |
| 257 | 235 | 'max' => 100, |
| @@ -257,19 +235,23 @@ | ||
| 257 | 235 | 'max' => 100, |
| 258 | 236 | 'step' => 10, |
| 259 | 237 | ], |
| 260 | 238 | 'px' => [ |
| 239 | + 'min' => 0, | |
| 261 | 240 | 'max' => 800, |
| 262 | 241 | 'step' => 50, |
| 263 | 242 | ], |
| 264 | 243 | ], |
| 265 | 244 | 'default' => [ |
| 245 | + 'unit' => 'px', | |
| 266 | 246 | 'size' => 500, |
| 267 | 247 | ], |
| 268 | 248 | 'tablet_default' => [ |
| 249 | + 'unit' => 'px', | |
| 269 | 250 | 'size' => 500, |
| 270 | 251 | ], |
| 271 | 252 | 'mobile_default' => [ |
| 253 | + 'unit' => 'px', | |
| 272 | 254 | 'size' => 500, |
| 273 | 255 | ], |
| 274 | 256 | 'selectors' => [ |
| 275 | 257 | '{{WRAPPER}}' => '--width: {{SIZE}}{{UNIT}};', |
| @@ -279,19 +261,29 @@ | ||
| 279 | 261 | |
| 280 | 262 | $this->add_responsive_control( |
| 281 | 263 | 'rotation', |
| 282 | 264 | [ |
| 283 | - 'label' => esc_html__( 'Rotate', 'elementor' ), | |
| 265 | + 'label' => __( 'Rotate', 'elementor' ), | |
| 284 | 266 | 'type' => Controls_Manager::SLIDER, |
| 285 | - 'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ], | |
| 267 | + 'size_units' => [ 'deg' ], | |
| 268 | + 'range' => [ | |
| 269 | + 'deg' => [ | |
| 270 | + 'min' => 0, | |
| 271 | + 'max' => 360, | |
| 272 | + 'step' => 1, | |
| 273 | + ], | |
| 274 | + ], | |
| 286 | 275 | 'default' => [ |
| 287 | 276 | 'unit' => 'deg', |
| 277 | + 'size' => '', | |
| 288 | 278 | ], |
| 289 | 279 | 'tablet_default' => [ |
| 290 | 280 | 'unit' => 'deg', |
| 281 | + 'size' => '', | |
| 291 | 282 | ], |
| 292 | 283 | 'mobile_default' => [ |
| 293 | 284 | 'unit' => 'deg', |
| 285 | + 'size' => '', | |
| 294 | 286 | ], |
| 295 | 287 | 'selectors' => [ |
| 296 | 288 | '{{WRAPPER}}' => '--rotate: {{SIZE}}{{UNIT}};', |
| 297 | 289 | ], |
| @@ -300,9 +292,9 @@ | ||
| 300 | 292 | |
| 301 | 293 | $this->add_control( |
| 302 | 294 | 'text_heading', |
| 303 | 295 | [ |
| 304 | - 'label' => esc_html__( 'Text', 'elementor' ), | |
| 296 | + 'label' => __( 'Text', 'elementor' ), | |
| 305 | 297 | 'type' => Controls_Manager::HEADING, |
| 306 | 298 | ] |
| 307 | 299 | ); |
| 308 | 300 | |
| @@ -321,54 +313,35 @@ | ||
| 321 | 313 | 'unit' => 'px', |
| 322 | 314 | ], |
| 323 | 315 | 'size_units' => [ 'px' ], |
| 324 | 316 | ], |
| 325 | - // Text decoration isn't an inherited property, so it's required to explicitly | |
| 326 | - // target the specific `textPath` element. | |
| 327 | - 'text_decoration' => [ | |
| 328 | - 'selectors' => [ | |
| 329 | - '{{WRAPPER}} textPath' => 'text-decoration: {{VALUE}};', | |
| 330 | - ], | |
| 331 | - ], | |
| 332 | 317 | ], |
| 333 | 318 | ] |
| 334 | 319 | ); |
| 335 | 320 | |
| 336 | - $this->add_group_control( | |
| 337 | - Group_Control_Text_Stroke::get_type(), | |
| 338 | - [ | |
| 339 | - 'name' => 'text_stroke', | |
| 340 | - 'selector' => '{{WRAPPER}} textPath', | |
| 341 | - ] | |
| 342 | - ); | |
| 343 | - | |
| 344 | 321 | $this->add_responsive_control( |
| 345 | 322 | 'word_spacing', |
| 346 | 323 | [ |
| 347 | - 'label' => esc_html__( 'Word Spacing', 'elementor' ), | |
| 324 | + 'label' => __( 'Word Spacing', 'elementor' ), | |
| 348 | 325 | 'type' => Controls_Manager::SLIDER, |
| 349 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 326 | + 'size_units' => [ 'px' ], | |
| 350 | 327 | 'range' => [ |
| 351 | 328 | 'px' => [ |
| 352 | 329 | 'min' => -20, |
| 353 | 330 | 'max' => 20, |
| 331 | + 'step' => 1, | |
| 354 | 332 | ], |
| 355 | - 'em' => [ | |
| 356 | - 'min' => -1, | |
| 357 | - 'max' => 1, | |
| 358 | - ], | |
| 359 | - 'rem' => [ | |
| 360 | - 'min' => -1, | |
| 361 | - 'max' => 1, | |
| 362 | - ], | |
| 363 | 333 | ], |
| 364 | 334 | 'default' => [ |
| 335 | + 'unit' => 'px', | |
| 365 | 336 | 'size' => '', |
| 366 | 337 | ], |
| 367 | 338 | 'tablet_default' => [ |
| 339 | + 'unit' => 'px', | |
| 368 | 340 | 'size' => '', |
| 369 | 341 | ], |
| 370 | 342 | 'mobile_default' => [ |
| 343 | + 'unit' => 'px', | |
| 371 | 344 | 'size' => '', |
| 372 | 345 | ], |
| 373 | 346 | 'selectors' => [ |
| 374 | 347 | '{{WRAPPER}}' => '--word-spacing: {{SIZE}}{{UNIT}};', |
| @@ -378,9 +351,9 @@ | ||
| 378 | 351 | |
| 379 | 352 | $this->add_control( |
| 380 | 353 | 'start_point', |
| 381 | 354 | [ |
| 382 | - 'label' => esc_html__( 'Starting Point', 'elementor' ) . ' (%)', | |
| 355 | + 'label' => __( 'Starting Point', 'elementor' ), | |
| 383 | 356 | 'type' => Controls_Manager::SLIDER, |
| 384 | 357 | 'size_units' => [ '%' ], |
| 385 | 358 | 'range' => [ |
| 386 | 359 | 'px' => [ |
| @@ -405,9 +378,9 @@ | ||
| 405 | 378 | */ |
| 406 | 379 | $this->start_controls_tab( |
| 407 | 380 | 'text_normal', |
| 408 | 381 | [ |
| 409 | - 'label' => esc_html__( 'Normal', 'elementor' ), | |
| 382 | + 'label' => __( 'Normal', 'elementor' ), | |
| 410 | 383 | ] |
| 411 | 384 | ); |
| 412 | 385 | |
| 413 | 386 | $this->add_control( |
| @@ -412,9 +385,9 @@ | ||
| 412 | 385 | |
| 413 | 386 | $this->add_control( |
| 414 | 387 | 'text_color_normal', |
| 415 | 388 | [ |
| 416 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 389 | + 'label' => __( 'Color', 'elementor' ), | |
| 417 | 390 | 'type' => Controls_Manager::COLOR, |
| 418 | 391 | 'default' => '', |
| 419 | 392 | 'selectors' => [ |
| 420 | 393 | '{{WRAPPER}}' => '--text-color: {{VALUE}};', |
| @@ -429,9 +402,9 @@ | ||
| 429 | 402 | */ |
| 430 | 403 | $this->start_controls_tab( |
| 431 | 404 | 'text_hover', |
| 432 | 405 | [ |
| 433 | - 'label' => esc_html__( 'Hover', 'elementor' ), | |
| 406 | + 'label' => __( 'Hover', 'elementor' ), | |
| 434 | 407 | ] |
| 435 | 408 | ); |
| 436 | 409 | |
| 437 | 410 | $this->add_control( |
| @@ -436,9 +409,9 @@ | ||
| 436 | 409 | |
| 437 | 410 | $this->add_control( |
| 438 | 411 | 'text_color_hover', |
| 439 | 412 | [ |
| 440 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 413 | + 'label' => __( 'Color', 'elementor' ), | |
| 441 | 414 | 'type' => Controls_Manager::COLOR, |
| 442 | 415 | 'default' => '', |
| 443 | 416 | 'selectors' => [ |
| 444 | 417 | '{{WRAPPER}}' => '--text-color-hover: {{VALUE}};', |
| @@ -448,9 +421,9 @@ | ||
| 448 | 421 | |
| 449 | 422 | $this->add_control( |
| 450 | 423 | 'hover_animation', |
| 451 | 424 | [ |
| 452 | - 'label' => esc_html__( 'Hover Animation', 'elementor' ), | |
| 425 | + 'label' => __( 'Hover Animation', 'elementor' ), | |
| 453 | 426 | 'type' => Controls_Manager::HOVER_ANIMATION, |
| 454 | 427 | ] |
| 455 | 428 | ); |
| 456 | 429 | |
| @@ -456,15 +429,21 @@ | ||
| 456 | 429 | |
| 457 | 430 | $this->add_control( |
| 458 | 431 | 'hover_transition', |
| 459 | 432 | [ |
| 460 | - 'label' => esc_html__( 'Transition Duration', 'elementor' ), | |
| 433 | + 'label' => __( 'Transition Duration', 'elementor' ), | |
| 461 | 434 | 'type' => Controls_Manager::SLIDER, |
| 462 | - 'size_units' => [ 's', 'ms', 'custom' ], | |
| 463 | 435 | 'default' => [ |
| 436 | + 'size' => 0.3, | |
| 464 | 437 | 'unit' => 's', |
| 465 | - 'size' => 0.3, | |
| 466 | 438 | ], |
| 439 | + 'range' => [ | |
| 440 | + 's' => [ | |
| 441 | + 'min' => 0, | |
| 442 | + 'max' => 3, | |
| 443 | + 'step' => 0.1, | |
| 444 | + ], | |
| 445 | + ], | |
| 467 | 446 | 'selectors' => [ |
| 468 | 447 | '{{WRAPPER}}' => '--transition: {{SIZE}}{{UNIT}}', |
| 469 | 448 | ], |
| 470 | 449 | ] |
| @@ -481,9 +460,9 @@ | ||
| 481 | 460 | */ |
| 482 | 461 | $this->start_controls_section( |
| 483 | 462 | 'section_style_path', |
| 484 | 463 | [ |
| 485 | - 'label' => esc_html__( 'Path', 'elementor' ), | |
| 464 | + 'label' => __( 'Path', 'elementor' ), | |
| 486 | 465 | 'tab' => Controls_Manager::TAB_STYLE, |
| 487 | 466 | 'condition' => [ |
| 488 | 467 | 'show_path!' => '', |
| 489 | 468 | ], |
| @@ -497,9 +476,9 @@ | ||
| 497 | 476 | */ |
| 498 | 477 | $this->start_controls_tab( |
| 499 | 478 | 'path_normal', |
| 500 | 479 | [ |
| 501 | - 'label' => esc_html__( 'Normal', 'elementor' ), | |
| 480 | + 'label' => __( 'Normal', 'elementor' ), | |
| 502 | 481 | ] |
| 503 | 482 | ); |
| 504 | 483 | |
| 505 | 484 | $this->add_control( |
| @@ -504,9 +483,9 @@ | ||
| 504 | 483 | |
| 505 | 484 | $this->add_control( |
| 506 | 485 | 'path_fill_normal', |
| 507 | 486 | [ |
| 508 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 487 | + 'label' => __( 'Color', 'elementor' ), | |
| 509 | 488 | 'type' => Controls_Manager::COLOR, |
| 510 | 489 | 'default' => '', |
| 511 | 490 | 'selectors' => [ |
| 512 | 491 | '{{WRAPPER}}' => '--path-fill: {{VALUE}};', |
| @@ -516,9 +495,9 @@ | ||
| 516 | 495 | |
| 517 | 496 | $this->add_control( |
| 518 | 497 | 'stroke_heading_normal', |
| 519 | 498 | [ |
| 520 | - 'label' => esc_html__( 'Stroke', 'elementor' ), | |
| 499 | + 'label' => __( 'Stroke', 'elementor' ), | |
| 521 | 500 | 'type' => Controls_Manager::HEADING, |
| 522 | 501 | ] |
| 523 | 502 | ); |
| 524 | 503 | |
| @@ -524,9 +503,9 @@ | ||
| 524 | 503 | |
| 525 | 504 | $this->add_control( |
| 526 | 505 | 'stroke_color_normal', |
| 527 | 506 | [ |
| 528 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 507 | + 'label' => __( 'Color', 'elementor' ), | |
| 529 | 508 | 'type' => Controls_Manager::COLOR, |
| 530 | 509 | 'default' => self::DEFAULT_PATH_FILL, |
| 531 | 510 | 'selectors' => [ |
| 532 | 511 | '{{WRAPPER}}' => '--stroke-color: {{VALUE}};', |
| @@ -536,25 +515,20 @@ | ||
| 536 | 515 | |
| 537 | 516 | $this->add_control( |
| 538 | 517 | 'stroke_width_normal', |
| 539 | 518 | [ |
| 540 | - 'label' => esc_html__( 'Width', 'elementor' ), | |
| 519 | + 'label' => __( 'Width', 'elementor' ), | |
| 541 | 520 | 'type' => Controls_Manager::SLIDER, |
| 542 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 543 | 521 | 'default' => [ |
| 544 | 522 | 'size' => 1, |
| 523 | + 'unit' => 'px', | |
| 545 | 524 | ], |
| 546 | 525 | 'range' => [ |
| 547 | 526 | 'px' => [ |
| 548 | - 'min' => 1, | |
| 527 | + 'min' => 0, | |
| 549 | 528 | 'max' => 20, |
| 529 | + 'step' => 1, | |
| 550 | 530 | ], |
| 551 | - 'em' => [ | |
| 552 | - 'max' => 2, | |
| 553 | - ], | |
| 554 | - 'rem' => [ | |
| 555 | - 'max' => 2, | |
| 556 | - ], | |
| 557 | 531 | ], |
| 558 | 532 | 'selectors' => [ |
| 559 | 533 | '{{WRAPPER}}' => '--stroke-width: {{SIZE}}{{UNIT}}', |
| 560 | 534 | ], |
| @@ -568,9 +542,9 @@ | ||
| 568 | 542 | */ |
| 569 | 543 | $this->start_controls_tab( |
| 570 | 544 | 'path_hover', |
| 571 | 545 | [ |
| 572 | - 'label' => esc_html__( 'Hover', 'elementor' ), | |
| 546 | + 'label' => __( 'Hover', 'elementor' ), | |
| 573 | 547 | ] |
| 574 | 548 | ); |
| 575 | 549 | |
| 576 | 550 | $this->add_control( |
| @@ -575,9 +549,9 @@ | ||
| 575 | 549 | |
| 576 | 550 | $this->add_control( |
| 577 | 551 | 'path_fill_hover', |
| 578 | 552 | [ |
| 579 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 553 | + 'label' => __( 'Color', 'elementor' ), | |
| 580 | 554 | 'type' => Controls_Manager::COLOR, |
| 581 | 555 | 'default' => '', |
| 582 | 556 | 'selectors' => [ |
| 583 | 557 | '{{WRAPPER}}' => '--path-fill-hover: {{VALUE}};', |
| @@ -587,9 +561,9 @@ | ||
| 587 | 561 | |
| 588 | 562 | $this->add_control( |
| 589 | 563 | 'stroke_heading_hover', |
| 590 | 564 | [ |
| 591 | - 'label' => esc_html__( 'Stroke', 'elementor' ), | |
| 565 | + 'label' => __( 'Stroke', 'elementor' ), | |
| 592 | 566 | 'type' => Controls_Manager::HEADING, |
| 593 | 567 | ] |
| 594 | 568 | ); |
| 595 | 569 | |
| @@ -595,9 +569,9 @@ | ||
| 595 | 569 | |
| 596 | 570 | $this->add_control( |
| 597 | 571 | 'stroke_color_hover', |
| 598 | 572 | [ |
| 599 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 573 | + 'label' => __( 'Color', 'elementor' ), | |
| 600 | 574 | 'type' => Controls_Manager::COLOR, |
| 601 | 575 | 'default' => '', |
| 602 | 576 | 'selectors' => [ |
| 603 | 577 | '{{WRAPPER}}' => '--stroke-color-hover: {{VALUE}};', |
| @@ -607,25 +581,20 @@ | ||
| 607 | 581 | |
| 608 | 582 | $this->add_control( |
| 609 | 583 | 'stroke_width_hover', |
| 610 | 584 | [ |
| 611 | - 'label' => esc_html__( 'Width', 'elementor' ), | |
| 585 | + 'label' => __( 'Width', 'elementor' ), | |
| 612 | 586 | 'type' => Controls_Manager::SLIDER, |
| 613 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 614 | 587 | 'default' => [ |
| 615 | 588 | 'size' => '', |
| 589 | + 'unit' => 'px', | |
| 616 | 590 | ], |
| 617 | 591 | 'range' => [ |
| 618 | 592 | 'px' => [ |
| 619 | - 'min' => 1, | |
| 593 | + 'min' => 0, | |
| 620 | 594 | 'max' => 20, |
| 595 | + 'step' => 1, | |
| 621 | 596 | ], |
| 622 | - 'em' => [ | |
| 623 | - 'max' => 2, | |
| 624 | - ], | |
| 625 | - 'rem' => [ | |
| 626 | - 'max' => 2, | |
| 627 | - ], | |
| 628 | 597 | ], |
| 629 | 598 | 'selectors' => [ |
| 630 | 599 | '{{WRAPPER}}' => '--stroke-width-hover: {{SIZE}}{{UNIT}}', |
| 631 | 600 | ], |
| @@ -634,15 +603,21 @@ | ||
| 634 | 603 | |
| 635 | 604 | $this->add_control( |
| 636 | 605 | 'stroke_transition', |
| 637 | 606 | [ |
| 638 | - 'label' => esc_html__( 'Transition Duration', 'elementor' ), | |
| 607 | + 'label' => __( 'Transition Duration', 'elementor' ), | |
| 639 | 608 | 'type' => Controls_Manager::SLIDER, |
| 640 | - 'size_units' => [ 's', 'ms', 'custom' ], | |
| 641 | 609 | 'default' => [ |
| 610 | + 'size' => 0.3, | |
| 642 | 611 | 'unit' => 's', |
| 643 | - 'size' => 0.3, | |
| 644 | 612 | ], |
| 613 | + 'range' => [ | |
| 614 | + 's' => [ | |
| 615 | + 'min' => 0, | |
| 616 | + 'max' => 3, | |
| 617 | + 'step' => 0.1, | |
| 618 | + ], | |
| 619 | + ], | |
| 645 | 620 | 'selectors' => [ |
| 646 | 621 | '{{WRAPPER}}' => '--stroke-transition: {{SIZE}}{{UNIT}}', |
| 647 | 622 | ], |
| 648 | 623 | ] |
| @@ -676,24 +651,20 @@ | ||
| 676 | 651 | */ |
| 677 | 652 | protected function render() { |
| 678 | 653 | $settings = $this->get_settings_for_display(); |
| 679 | 654 | |
| 680 | - // Get the path URL. | |
| 681 | - $path_url = ( 'custom' === $settings['path'] ) | |
| 682 | - ? wp_get_attachment_url( $settings['custom_path']['id'] ) | |
| 683 | - : Shapes_Module::get_path_url( $settings['path'] ); | |
| 655 | + // Get the shape SVG markup. | |
| 656 | + if ( 'custom' !== $settings['path'] ) { | |
| 657 | + $path_svg = Shapes_Module::get_path_svg( $settings['path'] ); | |
| 658 | + } else { | |
| 659 | + $url = $settings['custom_path']['url']; | |
| 660 | + // Get the file contents only if it's svg. | |
| 661 | + $path_svg = ( 'svg' === pathinfo( $url, PATHINFO_EXTENSION ) ) ? file_get_contents( $url ) : ''; | |
| 662 | + } | |
| 684 | 663 | |
| 685 | - // Remove the HTTP protocol to prevent Mixed Content error. | |
| 686 | - $path_url = preg_replace( '/^https?:/i', '', $path_url ); | |
| 664 | + // Add Text Path text. | |
| 665 | + $this->add_render_attribute( 'text_path', 'class', 'e-text-path' ); | |
| 687 | 666 | |
| 688 | - // Add Text Path attributes. | |
| 689 | - $this->add_render_attribute( 'text_path', [ | |
| 690 | - 'class' => 'e-text-path', | |
| 691 | - 'data-text' => htmlentities( esc_attr( $settings['text'] ) ), | |
| 692 | - 'data-url' => esc_url( $path_url ), | |
| 693 | - 'data-link-url' => esc_url( $settings['link']['url'] ?? '' ), | |
| 694 | - ] ); | |
| 695 | - | |
| 696 | 667 | // Add hover animation. |
| 697 | 668 | if ( ! empty( $settings['hover_animation'] ) ) { |
| 698 | 669 | $this->add_render_attribute( 'text_path', 'class', 'elementor-animation-' . $settings['hover_animation'] ); |
| 699 | 670 | } |
| @@ -699,8 +670,10 @@ | ||
| 699 | 670 | } |
| 700 | 671 | |
| 701 | 672 | // Render. |
| 702 | 673 | ?> |
| 703 | - <div <?php $this->print_render_attribute_string( 'text_path' ); ?>></div> | |
| 674 | + <div <?php echo $this->get_render_attribute_string( 'text_path' ); ?>> | |
| 675 | + <?php echo $path_svg; ?> | |
| 676 | + </div> | |
| 704 | 677 | <?php |
| 705 | 678 | } |
| 706 | 679 | } |