Skip to content

Commit d34ee83

Browse files
committed
- return NULL if a flexible content field has no layouts
1 parent 49a66a7 commit d34ee83

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/FieldType/FlexibleContent.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public static function register_field_type(): void {
4949
}
5050

5151
$layouts = [];
52+
53+
// If there are no layouts, return a NULL type
54+
if ( empty( $acf_field['layouts'] ) ) {
55+
return 'NULL';
56+
}
57+
5258
foreach ( $acf_field['layouts'] as $layout ) {
5359
$layout_type_name = Utils::format_type_name( $layout_interface_prefix . ' ' . $field_config->get_registry()->get_field_group_graphql_type_name( $layout ) ) . 'Layout';
5460
$layout['interfaces'] = [ $layout_interface_name ];

0 commit comments

Comments
 (0)