| @@ -153,10 +153,8 @@ | ||
| 153 | 153 | 'bold' => esc_html__( 'Bold', 'elementor' ), |
| 154 | 154 | ], |
| 155 | 155 | ]; |
| 156 | 156 | |
| 157 | - $fields = $this->add_font_variables_fields( $fields ); | |
| 158 | - | |
| 159 | 157 | $fields['text_transform'] = [ |
| 160 | 158 | 'label' => esc_html_x( 'Transform', 'Typography Control', 'elementor' ), |
| 161 | 159 | 'type' => Controls_Manager::SELECT, |
| 162 | 160 | 'default' => '', |
| @@ -211,9 +209,9 @@ | ||
| 211 | 209 | 'min' => 1, |
| 212 | 210 | ], |
| 213 | 211 | ], |
| 214 | 212 | 'responsive' => true, |
| 215 | - 'size_units' => [ 'px', 'em', 'rem', 'lh', 'rlh', 'custom' ], | |
| 213 | + 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 216 | 214 | 'selector_value' => 'line-height: {{SIZE}}{{UNIT}}', |
| 217 | 215 | ]; |
| 218 | 216 | |
| 219 | 217 | $fields['letter_spacing'] = [ |
| @@ -271,89 +269,8 @@ | ||
| 271 | 269 | 'selector_value' => 'word-spacing: {{SIZE}}{{UNIT}}', |
| 272 | 270 | ]; |
| 273 | 271 | |
| 274 | 272 | return $fields; |
| 275 | - } | |
| 276 | - | |
| 277 | - private function add_font_variables_fields( $fields ): array { | |
| 278 | - $font_variables = $this->get_font_variables(); | |
| 279 | - | |
| 280 | - if ( empty( $font_variables ) ) { | |
| 281 | - return $fields; | |
| 282 | - } | |
| 283 | - | |
| 284 | - $font_variables_conditions = [ | |
| 285 | - 'weight' => [], | |
| 286 | - 'width' => [], | |
| 287 | - ]; | |
| 288 | - | |
| 289 | - foreach ( $font_variables as $font => $variables ) { | |
| 290 | - foreach ( array_keys( $font_variables_conditions ) as $variable ) { | |
| 291 | - if ( in_array( $variable, $variables ) ) { | |
| 292 | - $font_variables_conditions[ $variable ][] = $font; | |
| 293 | - } | |
| 294 | - } | |
| 295 | - } | |
| 296 | - | |
| 297 | - if ( ! empty( $font_variables_conditions['weight'] ) ) { | |
| 298 | - $fields['weight'] = [ | |
| 299 | - 'label' => esc_html_x( 'Weight', 'Typography Control', 'elementor' ), | |
| 300 | - 'type' => Controls_Manager::SLIDER, | |
| 301 | - 'range' => [ | |
| 302 | - 'px' => [ | |
| 303 | - 'min' => 1, | |
| 304 | - 'max' => 1000, | |
| 305 | - ], | |
| 306 | - ], | |
| 307 | - 'condition' => [ | |
| 308 | - 'font_family' => $font_variables_conditions['weight'], | |
| 309 | - ], | |
| 310 | - 'responsive' => true, | |
| 311 | - 'selector_value' => 'font-weight: {{SIZE}};', | |
| 312 | - ]; | |
| 313 | - | |
| 314 | - $fields['font_weight']['condition'] = [ | |
| 315 | - 'font_family!' => $font_variables_conditions['weight'], | |
| 316 | - ]; | |
| 317 | - } | |
| 318 | - | |
| 319 | - if ( ! empty( $font_variables_conditions['width'] ) ) { | |
| 320 | - $fields['width'] = [ | |
| 321 | - 'label' => esc_html_x( 'Width', 'Typography Control', 'elementor' ), | |
| 322 | - 'type' => Controls_Manager::SLIDER, | |
| 323 | - 'range' => [ | |
| 324 | - 'px' => [ | |
| 325 | - 'min' => 0, | |
| 326 | - 'max' => 150, | |
| 327 | - ], | |
| 328 | - ], | |
| 329 | - 'condition' => [ | |
| 330 | - 'font_family' => $font_variables_conditions['width'], | |
| 331 | - ], | |
| 332 | - 'responsive' => true, | |
| 333 | - 'selector_value' => 'font-stretch: {{SIZE}}%;', | |
| 334 | - ]; | |
| 335 | - } | |
| 336 | - | |
| 337 | - $fields['font_style']['condition'] = [ | |
| 338 | - 'font_family!' => array_keys( $font_variables ), | |
| 339 | - ]; | |
| 340 | - | |
| 341 | - return $fields; | |
| 342 | - } | |
| 343 | - | |
| 344 | - private function get_font_variables() { | |
| 345 | - static $font_variables = null; | |
| 346 | - | |
| 347 | - if ( null === $font_variables ) { | |
| 348 | - $font_variables = apply_filters( 'elementor/typography/font_variables', [] ); | |
| 349 | - } | |
| 350 | - | |
| 351 | - return $font_variables; | |
| 352 | - } | |
| 353 | - | |
| 354 | - public static function get_font_variable_ranges() { | |
| 355 | - return apply_filters( 'elementor/typography/font_variable_ranges', [] ); | |
| 356 | 273 | } |
| 357 | 274 | |
| 358 | 275 | /** |
| 359 | 276 | * Prepare fields. |