Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

default relationship to array instead of null #236

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ protected function get_acf_field_value( $root, $acf_field, $format = false ) {
if ( 'wysiwyg' === $acf_field['type'] ) {
$format = true;
}

if ( 'select' === $acf_field['type'] ) {
$format = true;
}
Expand Down Expand Up @@ -474,7 +474,7 @@ protected function register_graphql_field( $type_name, $field_name, $config ) {
$field_config['type'] = [ 'list_of' => 'String' ];
$field_config['resolve'] = function( $root ) use ( $acf_field) {
$value = $this->get_acf_field_value( $root, $acf_field, true);

return ! empty( $value ) && is_array( $value ) ? $value : [];
};
}else{
Expand Down Expand Up @@ -569,7 +569,7 @@ protected function register_graphql_field( $type_name, $field_name, $config ) {
}
}

return isset( $value ) ? $relationship : null;
return isset( $value ) ? $relationship : [];

},
];
Expand Down