Find proper interface to pass to hook_entity_translation_*

Created on 22 November 2015, almost 10 years ago
Updated 9 September 2025, about 12 hours ago

Follow-up to #2620764-4: Fix entity.api hook_entity_translation_* examples β†’

Problem/Motivation

Currently this hooks documented like accepted EntityInterface but translation hooks are for \Drupal\Core\TypedData\TranslatableInterface.

This hooks are called from \Drupal\Core\Entity\ContentEntityStorageBase::invokeTranslationHooks() so they both use \Drupal\Core\TypedData\TranslatableInterface ($entity->getTranslation($langcode)) as argument, so this interface should be used.

On other hand \Drupal\Core\Entity\FieldableEntityInterface should be used because this hook is called only for content entities

Proposed resolution

use
\Drupal\Core\TypedData\TranslatableInterface
or
\Drupal\Core\Entity\FieldableEntityInterface

Remaining tasks

discuss, update hook examples

User interface changes

no

API changes

no

Data model changes

no

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

entity system

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. 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!

Production build 0.71.5 2024