Skip to content

Commit

Permalink
Skip output of has-aspect-ratio if value isn't set
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Jan 24, 2024
1 parent 39873bf commit 7e14457
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/block-supports/dimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ function gutenberg_render_dimensions_support( $block_content, $block ) {

if ( ! empty( $styles['classnames'] ) ) {
foreach ( explode( ' ', $styles['classnames'] ) as $class_name ) {
if (
str_contains( $class_name, 'aspect-ratio' ) &&
! isset( $block_attributes['style']['dimensions']['aspectRatio'] )
) {
continue;
}
$tags->add_class( $class_name );
}
}
Expand Down

0 comments on commit 7e14457

Please sign in to comment.