| @@ -111,20 +111,14 @@ | ||
| 111 | 111 | |
| 112 | 112 | $fields['font_size'] = [ |
| 113 | 113 | 'label' => esc_html_x( 'Size', 'Typography Control', 'elementor' ), |
| 114 | 114 | 'type' => Controls_Manager::SLIDER, |
| 115 | - 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], | |
| 115 | + 'size_units' => [ 'px', 'em', 'rem', 'vw' ], | |
| 116 | 116 | 'range' => [ |
| 117 | 117 | 'px' => [ |
| 118 | 118 | 'min' => 1, |
| 119 | 119 | 'max' => 200, |
| 120 | 120 | ], |
| 121 | - 'em' => [ | |
| 122 | - 'max' => 20, | |
| 123 | - ], | |
| 124 | - 'rem' => [ | |
| 125 | - 'max' => 20, | |
| 126 | - ], | |
| 127 | 121 | 'vw' => [ |
| 128 | 122 | 'min' => 0.1, |
| 129 | 123 | 'max' => 10, |
| 130 | 124 | 'step' => 0.1, |
| @@ -147,16 +141,14 @@ | ||
| 147 | 141 | '600' => '600 ' . esc_html_x( '(Semi Bold)', 'Typography Control', 'elementor' ), |
| 148 | 142 | '700' => '700 ' . esc_html_x( '(Bold)', 'Typography Control', 'elementor' ), |
| 149 | 143 | '800' => '800 ' . esc_html_x( '(Extra Bold)', 'Typography Control', 'elementor' ), |
| 150 | 144 | '900' => '900 ' . esc_html_x( '(Black)', 'Typography Control', 'elementor' ), |
| 151 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 152 | - 'normal' => esc_html__( 'Normal', 'elementor' ), | |
| 153 | - 'bold' => esc_html__( 'Bold', 'elementor' ), | |
| 145 | + '' => esc_html_x( 'Default', 'Typography Control', 'elementor' ), | |
| 146 | + 'normal' => esc_html_x( 'Normal', 'Typography Control', 'elementor' ), | |
| 147 | + 'bold' => esc_html_x( 'Bold', 'Typography Control', 'elementor' ), | |
| 154 | 148 | ], |
| 155 | 149 | ]; |
| 156 | 150 | |
| 157 | - $fields = $this->add_font_variables_fields( $fields ); | |
| 158 | - | |
| 159 | 151 | $fields['text_transform'] = [ |
| 160 | 152 | 'label' => esc_html_x( 'Transform', 'Typography Control', 'elementor' ), |
| 161 | 153 | 'type' => Controls_Manager::SELECT, |
| 162 | 154 | 'default' => '', |
| @@ -164,9 +156,9 @@ | ||
| 164 | 156 | '' => esc_html__( 'Default', 'elementor' ), |
| 165 | 157 | 'uppercase' => esc_html_x( 'Uppercase', 'Typography Control', 'elementor' ), |
| 166 | 158 | 'lowercase' => esc_html_x( 'Lowercase', 'Typography Control', 'elementor' ), |
| 167 | 159 | 'capitalize' => esc_html_x( 'Capitalize', 'Typography Control', 'elementor' ), |
| 168 | - 'none' => esc_html__( 'Normal', 'elementor' ), | |
| 160 | + 'none' => esc_html_x( 'Normal', 'Typography Control', 'elementor' ), | |
| 169 | 161 | ], |
| 170 | 162 | ]; |
| 171 | 163 | |
| 172 | 164 | $fields['font_style'] = [ |
| @@ -174,9 +166,9 @@ | ||
| 174 | 166 | 'type' => Controls_Manager::SELECT, |
| 175 | 167 | 'default' => '', |
| 176 | 168 | 'options' => [ |
| 177 | 169 | '' => esc_html__( 'Default', 'elementor' ), |
| 178 | - 'normal' => esc_html__( 'Normal', 'elementor' ), | |
| 170 | + 'normal' => esc_html_x( 'Normal', 'Typography Control', 'elementor' ), | |
| 179 | 171 | 'italic' => esc_html_x( 'Italic', 'Typography Control', 'elementor' ), |
| 180 | 172 | 'oblique' => esc_html_x( 'Oblique', 'Typography Control', 'elementor' ), |
| 181 | 173 | ], |
| 182 | 174 | ]; |
| @@ -189,14 +181,14 @@ | ||
| 189 | 181 | '' => esc_html__( 'Default', 'elementor' ), |
| 190 | 182 | 'underline' => esc_html_x( 'Underline', 'Typography Control', 'elementor' ), |
| 191 | 183 | 'overline' => esc_html_x( 'Overline', 'Typography Control', 'elementor' ), |
| 192 | 184 | 'line-through' => esc_html_x( 'Line Through', 'Typography Control', 'elementor' ), |
| 193 | - 'none' => esc_html__( 'None', 'elementor' ), | |
| 185 | + 'none' => esc_html_x( 'None', 'Typography Control', 'elementor' ), | |
| 194 | 186 | ], |
| 195 | 187 | ]; |
| 196 | 188 | |
| 197 | 189 | $fields['line_height'] = [ |
| 198 | - 'label' => esc_html__( 'Line Height', 'elementor' ), | |
| 190 | + 'label' => esc_html_x( 'Line-Height', 'Typography Control', 'elementor' ), | |
| 199 | 191 | 'type' => Controls_Manager::SLIDER, |
| 200 | 192 | 'desktop_default' => [ |
| 201 | 193 | 'unit' => 'em', |
| 202 | 194 | ], |
| @@ -211,16 +203,16 @@ | ||
| 211 | 203 | 'min' => 1, |
| 212 | 204 | ], |
| 213 | 205 | ], |
| 214 | 206 | 'responsive' => true, |
| 215 | - 'size_units' => [ 'px', 'em', 'rem', 'lh', 'rlh', 'custom' ], | |
| 207 | + 'size_units' => [ 'px', 'em' ], | |
| 216 | 208 | 'selector_value' => 'line-height: {{SIZE}}{{UNIT}}', |
| 217 | 209 | ]; |
| 218 | 210 | |
| 219 | 211 | $fields['letter_spacing'] = [ |
| 220 | - 'label' => esc_html__( 'Letter Spacing', 'elementor' ), | |
| 212 | + 'label' => esc_html_x( 'Letter Spacing', 'Typography Control', 'elementor' ), | |
| 221 | 213 | 'type' => Controls_Manager::SLIDER, |
| 222 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 214 | + 'size_units' => [ 'px', 'em' ], | |
| 223 | 215 | 'range' => [ |
| 224 | 216 | 'px' => [ |
| 225 | 217 | 'min' => -5, |
| 226 | 218 | 'max' => 10, |
| @@ -226,17 +218,10 @@ | ||
| 226 | 218 | 'max' => 10, |
| 227 | 219 | 'step' => 0.1, |
| 228 | 220 | ], |
| 229 | 221 | 'em' => [ |
| 230 | - 'min' => 0, | |
| 231 | - 'max' => 1, | |
| 232 | - 'step' => 0.01, | |
| 222 | + 'step' => 0.1, | |
| 233 | 223 | ], |
| 234 | - 'rem' => [ | |
| 235 | - 'min' => 0, | |
| 236 | - 'max' => 1, | |
| 237 | - 'step' => 0.01, | |
| 238 | - ], | |
| 239 | 224 | ], |
| 240 | 225 | 'responsive' => true, |
| 241 | 226 | 'selector_value' => 'letter-spacing: {{SIZE}}{{UNIT}}', |
| 242 | 227 | ]; |
| @@ -241,24 +226,10 @@ | ||
| 241 | 226 | 'selector_value' => 'letter-spacing: {{SIZE}}{{UNIT}}', |
| 242 | 227 | ]; |
| 243 | 228 | |
| 244 | 229 | $fields['word_spacing'] = [ |
| 245 | - 'label' => esc_html__( 'Word Spacing', 'elementor' ), | |
| 230 | + 'label' => esc_html_x( 'Word Spacing', 'Typography Control', 'elementor' ), | |
| 246 | 231 | 'type' => Controls_Manager::SLIDER, |
| 247 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 248 | - 'range' => [ | |
| 249 | - 'px' => [ | |
| 250 | - 'max' => 50, | |
| 251 | - ], | |
| 252 | - 'em' => [ | |
| 253 | - 'min' => 0, | |
| 254 | - 'max' => 5, | |
| 255 | - ], | |
| 256 | - 'rem' => [ | |
| 257 | - 'min' => 0, | |
| 258 | - 'max' => 5, | |
| 259 | - ], | |
| 260 | - ], | |
| 261 | 232 | 'desktop_default' => [ |
| 262 | 233 | 'unit' => 'em', |
| 263 | 234 | ], |
| 264 | 235 | 'tablet_default' => [ |
| @@ -266,8 +237,17 @@ | ||
| 266 | 237 | ], |
| 267 | 238 | 'mobile_default' => [ |
| 268 | 239 | 'unit' => 'em', |
| 269 | 240 | ], |
| 241 | + 'size_units' => [ 'px', 'em' ], | |
| 242 | + 'range' => [ | |
| 243 | + 'px' => [ | |
| 244 | + 'step' => 1, | |
| 245 | + ], | |
| 246 | + 'em' => [ | |
| 247 | + 'step' => 0.1, | |
| 248 | + ], | |
| 249 | + ], | |
| 270 | 250 | 'responsive' => true, |
| 271 | 251 | 'selector_value' => 'word-spacing: {{SIZE}}{{UNIT}}', |
| 272 | 252 | ]; |
| 273 | 253 | |
| @@ -273,89 +253,8 @@ | ||
| 273 | 253 | |
| 274 | 254 | return $fields; |
| 275 | 255 | } |
| 276 | 256 | |
| 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 | - } | |
| 357 | - | |
| 358 | 257 | /** |
| 359 | 258 | * Prepare fields. |
| 360 | 259 | * |
| 361 | 260 | * Process typography control fields before adding them to `add_control()`. |
| @@ -432,9 +331,9 @@ | ||
| 432 | 331 | protected function get_default_options() { |
| 433 | 332 | return [ |
| 434 | 333 | 'popover' => [ |
| 435 | 334 | 'starter_name' => 'typography', |
| 436 | - 'starter_title' => esc_html__( 'Typography', 'elementor' ), | |
| 335 | + 'starter_title' => esc_html_x( 'Typography', 'Typography Control', 'elementor' ), | |
| 437 | 336 | 'settings' => [ |
| 438 | 337 | 'render_type' => 'ui', |
| 439 | 338 | 'groupType' => 'typography', |
| 440 | 339 | 'global' => [ |