Postponed (maintainer needs more info)
Project:
Drupal core
Version:
main
Component:
serialization.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Oct 2017 at 12:15 UTC
Updated:
15 Oct 2025 at 14:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersComment #3
tedbowI like the change and it seems like it could reduce extra requests for each referenced entity to get the label.
I would hope we would not need another BC_* flag for this. I guess this something we didn't talk about in DrupalCon Vienna, whether API additions would need this BC_* flags.
I think if we can keep those to changes to existing field changes values that would be better and simpler.
We will need tests to prove these labels are actually returned, maybe just up the existing REST entity tests.
Comment #4
wim leersThere should be lots and lots of failing tests due to these changes — IOW existing test coverage already covers this :)
Comment #6
tedbowAdded 'label' key to tests where needed.
Comment #8
tedbowThis patch fixes media test fail.
Another problem I am seeing is the difference in how Config Entity(really non
FieldableEntityInterface) is handled in hal_json format.In the current patch
NodeHalJsonAnonTestpasses butNodeJsonAnonTestdoes not(there are other similar cases).This is because they both rely on
\Drupal\Tests\rest\Functional\EntityResource\Node\NodeResourceTestBase::getExpectedNormalizedEntityfor the value oftypewhich is an entity reference field with the target typenode_type.For json format the label 'article' is returned but for 'hal_json' not label is returned.
This because in
\Drupal\hal\Normalizer\EntityReferenceItemNormalizer::normalizewe haveSo for
node_typeit is handled by\Drupal\hal\Normalizer\FieldItemNormalizerwhich does not handle 'label'.So maybe we I think should either handle the logic for Config entities in
\Drupal\hal\Normalizer\EntityReferenceItemNormalizeralso or we could change it toContentEntityReferenceItemNormalizerand add a newConfigEntityReferenceItemNormalizer. They would both haveprotected $supportedInterfaceOrClass = 'Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem';So we would have to
supportsNormalization()in each normalizer to make sure they only covered the correct$target_entityvalues.Of if changing the name of
EntityReferenceItemNormalizeris a BC break we could just add the newConfigEntityReferenceItemNormalizerbut still usesupportsNormalization()in both the new and existing normalizers.Comment #21
smustgrave commentedThank you for sharing your idea for improving Drupal.
We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!