Skip to content

Commit 862831e

Browse files
authored
Data binding: make sure field_name is a string, otherwise a fatal error occurs (#558)
1 parent 27d6df4 commit 862831e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

inc/Editor/DataBinding/BlockBindings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public static function get_value( array $source_args, WP_Block|array $block, str
280280

281281
// Extract field information from the binding source args.
282282
$field_label = $source_args['label'] ?? null;
283-
$field_name = $source_args['field'] ?? null;
283+
$field_name = $source_args['field'] ?? '';
284284
$field_type = $source_args['type'] ?? 'field';
285285
$result_index = $source_args['index'] ?? 0;
286286

@@ -300,7 +300,7 @@ public static function get_value( array $source_args, WP_Block|array $block, str
300300
'remote_data_block_name' => $block_name,
301301
];
302302

303-
if ( null === $field_name ) {
303+
if ( empty( $field_name ) ) {
304304
self::log_error( $log_context, new WP_Error(
305305
'remote_data_blocks_binding_get_value_error',
306306
'Missing field mapping for block binding',

0 commit comments

Comments
 (0)