Skip to content

Commit fa96f64

Browse files
Block Supports: Add height to dimensions supports
1 parent 5889df3 commit fa96f64

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

src/wp-includes/block-supports/dimensions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function wp_apply_dimensions_support( $block_type, $block_attributes ) {
6464
}
6565

6666
$dimensions_block_styles = array();
67-
$supported_features = array( 'minHeight', 'width' );
67+
$supported_features = array( 'minHeight', 'height', 'width' );
6868

6969
foreach ( $supported_features as $feature ) {
7070
$has_support = block_has_support( $block_type, array( 'dimensions', $feature ), false );

src/wp-includes/class-wp-theme-json.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class WP_Theme_JSON {
237237
* @since 6.5.0 Added `aspect-ratio` property.
238238
* @since 6.6.0 Added `background-[image|position|repeat|size]` properties.
239239
* @since 6.7.0 Added `background-attachment` property.
240-
* @since 7.0.0 Added `dimensions.width`.
240+
* @since 7.0.0 Added `dimensions.width` and `dimensions.height`.
241241
* @var array
242242
*/
243243
const PROPERTIES_METADATA = array(
@@ -302,6 +302,7 @@ class WP_Theme_JSON {
302302
'text-transform' => array( 'typography', 'textTransform' ),
303303
'filter' => array( 'filter', 'duotone' ),
304304
'box-shadow' => array( 'shadow' ),
305+
'height' => array( 'dimensions', 'height' ),
305306
'width' => array( 'dimensions', 'width' ),
306307
'writing-mode' => array( 'typography', 'writingMode' ),
307308
);
@@ -397,7 +398,7 @@ class WP_Theme_JSON {
397398
* @since 6.6.0 Added support for 'dimensions.aspectRatios', 'dimensions.defaultAspectRatios',
398399
* 'typography.defaultFontSizes', and 'spacing.defaultSpacingSizes'.
399400
* @since 6.9.0 Added support for `border.radiusSizes`.
400-
* @since 7.0.0 Added support for `dimensions.width`.
401+
* @since 7.0.0 Added support for `dimensions.width` and `dimensions.height`.
401402
* @var array
402403
*/
403404
const VALID_SETTINGS = array(
@@ -436,6 +437,7 @@ class WP_Theme_JSON {
436437
'aspectRatio' => null,
437438
'aspectRatios' => null,
438439
'defaultAspectRatios' => null,
440+
'height' => null,
439441
'minHeight' => null,
440442
'width' => null,
441443
),
@@ -531,7 +533,7 @@ class WP_Theme_JSON {
531533
* @since 6.3.0 Added support for `typography.textColumns`.
532534
* @since 6.5.0 Added support for `dimensions.aspectRatio`.
533535
* @since 6.6.0 Added `background` sub properties to top-level only.
534-
* @since 7.0.0 Added support for `dimensions.width`.
536+
* @since 7.0.0 Added support for `dimensions.width` and `dimensions.height`.
535537
* @var array
536538
*/
537539
const VALID_STYLES = array(
@@ -559,6 +561,7 @@ class WP_Theme_JSON {
559561
),
560562
'dimensions' => array(
561563
'aspectRatio' => null,
564+
'height' => null,
562565
'minHeight' => null,
563566
'width' => null,
564567
),
@@ -732,7 +735,7 @@ public static function get_element_class_name( $element ) {
732735
* @since 6.2.0 Added `dimensions.minHeight` and `position.sticky`.
733736
* @since 6.4.0 Added `background.backgroundImage`.
734737
* @since 6.5.0 Added `background.backgroundSize` and `dimensions.aspectRatio`.
735-
* @since 7.0.0 Added `dimensions.width`.
738+
* @since 7.0.0 Added `dimensions.width` and `dimensions.height`.
736739
* @var array
737740
*/
738741
const APPEARANCE_TOOLS_OPT_INS = array(
@@ -747,6 +750,7 @@ public static function get_element_class_name( $element ) {
747750
array( 'color', 'button' ),
748751
array( 'color', 'caption' ),
749752
array( 'dimensions', 'aspectRatio' ),
753+
array( 'dimensions', 'height' ),
750754
array( 'dimensions', 'minHeight' ),
751755
array( 'dimensions', 'width' ),
752756
array( 'position', 'sticky' ),

src/wp-includes/style-engine/class-wp-style-engine.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ final class WP_Style_Engine {
210210
'has-aspect-ratio' => true,
211211
),
212212
),
213+
'height' => array(
214+
'property_keys' => array(
215+
'default' => 'height',
216+
),
217+
'path' => array( 'dimensions', 'height' ),
218+
),
213219
'minHeight' => array(
214220
'property_keys' => array(
215221
'default' => 'min-height',

tests/phpunit/tests/theme/wpThemeJson.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ public function test_get_settings_appearance_true_opts_in() {
280280
),
281281
'dimensions' => array(
282282
'aspectRatio' => true,
283+
'height' => true,
283284
'minHeight' => true,
284285
'width' => true,
285286
),
@@ -319,6 +320,7 @@ public function test_get_settings_appearance_true_opts_in() {
319320
),
320321
'dimensions' => array(
321322
'aspectRatio' => true,
323+
'height' => true,
322324
'minHeight' => true,
323325
'width' => true,
324326
),

0 commit comments

Comments
 (0)