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.
The node translation handler changes the node edit form.
It adds a translation message to the submit button, but also does this to the publish and unpublish button which are removed in #2068063: Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button
if (isset($status_translatable)) {
foreach (['publish', 'unpublish', 'submit'] as $button) {
if (isset($form['actions'][$button])) {
$form['actions'][$button]['#value'] .= ' ' . ($status_translatable ? t('(this translation)') : t('(all translations)'));
}
}
}
Comment | File | Size | Author |
---|---|---|---|
#3 | translation-old-buttons-2917031-3.patch | 896 bytes | mallezie |
Comments
Comment #2
mallezieComment #3
mallezieAnd a patch
Comment #4
timmillwoodI guess this shows we didn't have suitable test coverage for this.
Also, maybe this should be abstracted out of Node and added for all translatable entities.
Comment #5
mallezieNot sure about the test-coverage.
It's actually just dead code. There is no publish and unpublish button anymore so the value is never adjusted of that button.
I actually found out about the code through #2915231: Deprecated action buttons in node form which is a 'bug' in rabbit_hole wich assumes those buttons are their, and adds some elements to it, making the above code do run and throw a warning.
About the abstraction, seems we can up that to the ContentTranslationHandler class, but then we would add that label to all translatable content entities, which doesn't sound bad, but is a change if i'm not wrong.
It was done in the nodetranslationhandler since that was the one with all 3 buttons (submit / publish / unpublish) at least before the drop button removal.
Comment #6
timmillwoodI guess we can add a follow up for the abstraction part.
Comment #7
catchCommitted 1a7ba41 and pushed to 8.5.x. Thanks!
Comment #9
timmillwoodI think this should be cherry picked to 8.4.x because we're seeing bug reports of the same issue. For example #2918433: Notice: Undefined index: #value in Drupal\node\NodeTranslationHandler->entityFormAlter().
Comment #11
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedIf this patch is fixing #2918433: Notice: Undefined index: #value in Drupal\node\NodeTranslationHandler->entityFormAlter() than this is bug, not a task, so we have to treat it as such and backport it to 8.4.x.
Comment #13
slydevil CreditAttribution: slydevil commentedIssue #2918433 can also use the attached patch as it applies to the 8.4 code base cleanly. Setting this to fixed again.
Comment #14
timmillwoodI still think we should cherry pick this issue back to 8.4.x
Comment #15
slydevil CreditAttribution: slydevil commentedOk, I've added the exact same patch to the other issue...and re-opened.
Comment #16
xjmCherry-picked to 8.4.x. Thanks!
Comment #17
timmillwoodThank you @xjm.