Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The examples in entity.api.php
using protected properties and wrong methods that was forgotten to update in #1810370: Entity Translation API improvements
Proposed resolution
Fix example code to point proper method
Remaining tasks
review and commit
User interface changes
no
API changes
no
Data model changes
no
Comment | File | Size | Author |
---|---|---|---|
#2 | 2620764-2.patch | 2.46 KB | andypost |
Comments
Comment #2
andypostThe only question left here about usage of
$translation->getUntranslated()
There's no such method on
EntityInterface
so probablyTranslatableInterface
should be passed to hookComment #3
plachThanks!
Comment #4
andypost@plach As I see, hooks are from
\Drupal\Core\Entity\ContentEntityStorageBase::invokeTranslationHooks()
and they both use\Drupal\Core\TypedData\TranslatableInterface
as argument.So the question is what interface should be used in this hooks. I'm sure that should be at least
\Drupal\Core\Entity\FieldableEntityInterface
because this hook is called only for content entitiesComment #5
xjmThanks @andypost. Maybe we can create a followup for #4? Since actually requiring a more specific interface is not really patch-release-friendly. Maybe we could add a comment to the hook documentation to start. But let's discuss that separately since this patch already corrects totally outdated/wrong entity API code examples.
Meanwhile, committed and pushed to 8.1.x and 8.0.x.
Comment #8
andypostFollow-up filed #2620942: Find proper interface to pass to hook_entity_translation_*
Comment #9
andypost