Revert "Issue #2575843 by raman.b, ankithashetty, tassilogroeper, Hardik_Patel_12, smustgrave: Cleanup ContentTranslationHandler"
This reverts commit 0d720c3cc6
.
merge-requests/3385/merge
parent
70700fcc7d
commit
0da5ef42cc
|
@ -563,21 +563,13 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface, E
|
|||
*
|
||||
* @see \Drupal\content_translation\ContentTranslationHandler::entityFormAlter()
|
||||
*/
|
||||
public function entityFormSharedElements(array $element, FormStateInterface $form_state, $form) {
|
||||
public function entityFormSharedElements($element, FormStateInterface $form_state, $form) {
|
||||
static $ignored_types;
|
||||
|
||||
// @todo Find a more reliable way to determine if a form element concerns a
|
||||
// multilingual value.
|
||||
if (!isset($ignored_types)) {
|
||||
$ignored_types = array_flip([
|
||||
'actions',
|
||||
'value',
|
||||
'hidden',
|
||||
'vertical_tabs',
|
||||
'token',
|
||||
'details',
|
||||
'link',
|
||||
]);
|
||||
$ignored_types = array_flip(['actions', 'value', 'hidden', 'vertical_tabs', 'token', 'details', 'link']);
|
||||
}
|
||||
|
||||
/** @var \Drupal\Core\Entity\ContentEntityForm $form_object */
|
||||
|
@ -598,14 +590,13 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface, E
|
|||
if (!isset($element[$key]['#type'])) {
|
||||
$this->entityFormSharedElements($element[$key], $form_state, $form);
|
||||
}
|
||||
else {
|
||||
// Ignore non-widget form elements.
|
||||
if (isset($ignored_types[$element[$key]['#type']])) {
|
||||
continue;
|
||||
}
|
||||
// Elements are considered to be non-multilingual by default.
|
||||
if (!empty($element[$key]['#multilingual'])) {
|
||||
continue;
|
||||
}
|
||||
// Elements are considered to be non multilingual by default.
|
||||
if (empty($element[$key]['#multilingual'])) {
|
||||
// If we are displaying a multilingual entity form we need to provide
|
||||
// translatability clues, otherwise the non-multilingual form elements
|
||||
// should be hidden.
|
||||
|
@ -623,6 +614,8 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface, E
|
|||
$element[$key]['#access'] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($display_warning && !$form_state->isSubmitted() && !$form_state->isRebuilding()) {
|
||||
$url = $entity->getUntranslated()->toUrl('edit-form')->toString();
|
||||
|
|
Loading…
Reference in New Issue