function template_preprocess_entity_translation_unified_form__a11y_accordion_tabs__wrapper in Entity Translation Unified Form 8
Prepare field variables for the form wrapper template.
Implements hook_preprocess_HOOK().
File
- ./
entity_translation_unified_form.theme.inc, line 28
Code
function template_preprocess_entity_translation_unified_form__a11y_accordion_tabs__wrapper(&$variables) {
$variables['#attached']['library'][] = 'entity_translation_unified_form/a11y-accordion-tabs';
$current_language = \Drupal::languageManager()
->getCurrentLanguage();
$id = $variables['element']['#id'];
$variables['fields'][$id] = array(
'id' => $id,
'language_name' => t($current_language
->getName()),
'label' => isset($variables['element']['widget']['#title']) ? $variables['element']['widget']['#title'] : NULL,
'markup' => $variables['element']['#children'],
);
$other_languages = EtufHelper::getOtherEnabledLanguages();
foreach ($other_languages as $langcode => $language) {
if (isset($variables['element'][$langcode]['#id'])) {
$id = $variables['element'][$langcode]['#id'];
$variables['fields'][$id] = array(
'id' => $id,
'language_name' => t($language),
'label' => isset($variables['element'][$langcode]['widget']['#title']) ? $variables['element'][$langcode]['widget']['#title'] : NULL,
'markup' => isset($variables['element'][$langcode]['#children']) ? $variables['element'][$langcode]['#children'] : NULL,
);
}
}
}