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
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | Issue-3310356-incorrect_entityin-build-render-array-1.patch | 1.65 KB | gaurav_manerkar |
Comments
Comment #2
gaurav_manerkar CreditAttribution: gaurav_manerkar commentedComment #3
Wim LeersThat loop is wrapped in an
if ($use_latest_revisions) {…}
.And that is computed like this:
Based on what you're saying, it sounds like you think that logic is broken? If you change that line to
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.
Comment #4
gaurav_manerkar CreditAttribution: gaurav_manerkar commentedHi,
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.
Comment #5
gaurav_manerkar CreditAttribution: gaurav_manerkar commentedComment #6
gaurav_manerkar CreditAttribution: gaurav_manerkar commented