Skip to content

Commit

Permalink
Add safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Sep 6, 2024
1 parent dd28386 commit b5dc992
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/compat/wordpress-6.7/block-bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ function gutenberg_add_can_update_block_bindings_editor_setting( $editor_setting
* @return array Modified arguments array including `label`.
*/
function gutenberg_update_meta_args_with_label( $args ) {
// Default to empty string.
$schema = array( 'title' => isset( $args['label'] ) ? $args['label'] : '' );
// Don't update schema when label isn't provided.
if ( ! isset( $args['label'] ) ) {
return $args;
}

$schema = array( 'title' => $args['label'] );
if ( ! is_array( $args['show_in_rest'] ) ) {
$args['show_in_rest'] = array(
'schema' => $schema,
Expand Down

0 comments on commit b5dc992

Please sign in to comment.