src/Normalizer/EntityReferenceFieldNormalizer.php | 11 ++++++++- tests/src/Functional/TermTest.php | 30 +++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/Normalizer/EntityReferenceFieldNormalizer.php b/src/Normalizer/EntityReferenceFieldNormalizer.php index 1389f43..61e9413 100644 --- a/src/Normalizer/EntityReferenceFieldNormalizer.php +++ b/src/Normalizer/EntityReferenceFieldNormalizer.php @@ -105,7 +105,16 @@ class EntityReferenceFieldNormalizer extends FieldNormalizer implements Denormal // "" term. if (!$item->isEmpty() && $item->get('entity')->getValue() === NULL) { $entity_list[] = NULL; - $entity_list_metadata[] = []; + $entity_list_metadata[] = [ + 'links' => [ + 'help' => [ + 'href' => 'https://www.drupal.org/docs/8/modules/json-api/core-concepts#virtual', + 'meta' => [ + 'about' => "Usage and meaning of the 'virtual' resource identifier.", + ], + ], + ], + ]; continue; } diff --git a/tests/src/Functional/TermTest.php b/tests/src/Functional/TermTest.php index 5c3e12d..879416c 100644 --- a/tests/src/Functional/TermTest.php +++ b/tests/src/Functional/TermTest.php @@ -131,6 +131,16 @@ class TermTest extends ResourceTestBase { [ 'id' => 'virtual', 'type' => 'taxonomy_term--camelids', + 'meta' => [ + 'links' => [ + 'help' => [ + 'href' => 'https://www.drupal.org/docs/8/modules/json-api/core-concepts#virtual', + 'meta' => [ + 'about' => "Usage and meaning of the 'virtual' resource identifier.", + ], + ], + ], + ], ], ], 'links' => [ @@ -161,6 +171,16 @@ class TermTest extends ResourceTestBase { [ 'id' => 'virtual', 'type' => 'taxonomy_term--camelids', + 'meta' => [ + 'links' => [ + 'help' => [ + 'href' => 'https://www.drupal.org/docs/8/modules/json-api/core-concepts#virtual', + 'meta' => [ + 'about' => "Usage and meaning of the 'virtual' resource identifier.", + ], + ], + ], + ], ], [ 'id' => Term::load(2)->uuid(), @@ -276,6 +296,16 @@ class TermTest extends ResourceTestBase { 0 => [ 'id' => 'virtual', 'type' => 'taxonomy_term--camelids', + 'meta' => [ + 'links' => [ + 'help' => [ + 'href' => 'https://www.drupal.org/docs/8/modules/json-api/core-concepts#virtual', + 'meta' => [ + 'about' => "Usage and meaning of the 'virtual' resource identifier.", + ], + ], + ], + ], ], ]; }