Problem/Motivation

overview method of ContentTranslationController class returns the revison entity in the build render array when content moderation workflow is enabled for the entity type.

Looks like there is a code error which returns the last assigned revision from the for loop (line: 152-161 in ContentTranslationController.php)

Proposed resolution

Entity from page context should be assigned and not the revision entity.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gaurav.manerkar created an issue. See original summary.

gaurav_manerkar’s picture

Wim Leers’s picture

Status: Active » Postponed (maintainer needs more info)
Related issues: +#2949710: Pending revisions may become unavailable when untranslatable fields affect all translations

That loop is wrapped in an if ($use_latest_revisions) {…}.

And that is computed like this:

$use_latest_revisions = $entity_type->isRevisionable() && ContentTranslationManager::isPendingRevisionSupportEnabled($entity_type_id, $entity->bundle());

Based on what you're saying, it sounds like you think that logic is broken? If you change that line to

$use_latest_revisions = FALSE;

does it then behave as you expect?

If so, then AFAICT you think that #2949710: Pending revisions may become unavailable when untranslatable fields affect all translations was incorrect, because that introduced that logic.

gaurav_manerkar’s picture

Hi,

Currently, The last revision entity from for loop is assigned to $build['#entity'] (line 330) and also its label is used in $build['#title'] (line 326) in ContentTranslationController.php. I feel its incorrect.

The correct entity and label from obtained on (line 104) should be used.

gaurav_manerkar’s picture

Status: Postponed (maintainer needs more info) » Needs review
gaurav_manerkar’s picture

Status: Needs review » Postponed

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.