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

CommentFileSizeAuthor
#2 2620764-2.patch2.46 KBandypost
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
Issue tags: +D8MI, +language-content
FileSize
2.46 KB

The only question left here about usage of $translation->getUntranslated()
There's no such method on EntityInterface so probably TranslatableInterface should be passed to hook

plach’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +sprint

Thanks!

andypost’s picture

@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 entities

xjm’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Needs followup

Thanks @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.

  • xjm committed 3dd5b1f on 8.1.x
    Issue #2620764 by andypost: Fix entity.api hook_entity_translation_*...

  • xjm committed a3a17c5 on
    Issue #2620764 by andypost: Fix entity.api hook_entity_translation_*...
andypost’s picture

andypost’s picture

Issue tags: -sprint

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.