PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | lib/block-supports/block-style-variations.php +14 -4 23.5.2 → 24.1.0 View file →
@@ -166,8 +166,13 @@
166 166 'blocks' => $blocks_data,
167 167 ),
168 168 );
169 169
170 + // Ensure variation state styles know about any custom viewport breakpoints.
171 + if ( isset( $theme_json['settings']['viewport'] ) ) {
172 + $config['settings']['viewport'] = $theme_json['settings']['viewport'];
173 + }
174 +
170 175 // Turn off filter that excludes block nodes. They are needed here for the variation's inner block types.
171 176 if ( ! is_admin() ) {
172 177 remove_filter( 'wp_theme_json_get_style_nodes', 'wp_filter_out_block_nodes' );
173 178 }
@@ -219,12 +224,12 @@
219 224 * @since 6.6.0
220 225 *
221 226 * @see gutenberg_render_block_style_variation_support_styles
222 227 *
223 - * @param string $block_content Rendered block content.
224 - * @param array $block Block object.
228 + * @param string $block_content Rendered block content.
229 + * @param array $block Block object.
225 230 *
226 - * @return string Filtered block content.
231 + * @return string Filtered block content.
227 232 */
228 233 function gutenberg_render_block_style_variation_class_name( $block_content, $block ) {
229 234 if ( ! $block_content || empty( $block['attrs']['className'] ) ) {
230 235 return $block_content;
@@ -229,13 +234,18 @@
229 234 if ( ! $block_content || empty( $block['attrs']['className'] ) ) {
230 235 return $block_content;
231 236 }
232 237
238 + $block_class_name = $block['attrs']['className'];
239 + if ( ! is_string( $block_class_name ) ) {
240 + return $block_content;
241 + }
242 +
233 243 /*
234 244 * Matches a class prefixed by `is-style`, followed by the
235 245 * variation slug, then `--`, and finally an instance number.
236 246 */
237 - preg_match( '/\bis-style-(\S+?--\d+)\b/', $block['attrs']['className'], $matches );
247 + preg_match( '/\bis-style-(\S+?--\d+)\b/', $block_class_name, $matches );
238 248
239 249 if ( empty( $matches ) ) {
240 250 return $block_content;
241 251 }