diff --git a/planet4-gutenberg-blocks.php b/planet4-gutenberg-blocks.php index 3a0ce0d63f..47a77451e4 100644 --- a/planet4-gutenberg-blocks.php +++ b/planet4-gutenberg-blocks.php @@ -432,11 +432,6 @@ function ( $std_class_object ) { 'screen' => 600, 'width' => '540px', ], - [ - 'screen' => 576, - 'width' => '540px', - 'collapse' => true, - ], ]; add_filter( @@ -455,16 +450,16 @@ function ( $block_content, $block, WP_Block $instance ) use ( $breakpoints ) { $sizes = array_map( function ( $breakpoint ) use ( $column_count ) { - $screen = $breakpoint['screen']; - $container = $breakpoint['width']; - $column_count = isset( $breakpoint['collapse'] ) ? 1 : $column_count; + $screen = $breakpoint['screen']; + $container = $breakpoint['width']; + $cols_minus_one = $column_count - 1; - return "(min-width: ${screen}px) calc(($container / $column_count) - 1.25em * ($column_count - 1))"; + return "(min-width: ${screen}px) calc(($container / $column_count) - 1.25em * $cols_minus_one)"; }, $breakpoints ); - $sizes_attr = 'sizes="' . implode( ', ', $sizes ) . ', calc(100vw - 24px)"'; + $sizes_attr = 'sizes="' . implode( ', ', array_merge($sizes, ['calc(100vw - 24px)']) ) . '"'; // Assume all images are full width in a container. $block_content = preg_replace( '/sizes=".*"/', $sizes_attr, $block_content );