diff --git a/core/modules/content_translation/content_translation.libraries.yml b/core/modules/content_translation/content_translation.libraries.yml index 3dd1ce0..8850acf 100644 --- a/core/modules/content_translation/content_translation.libraries.yml +++ b/core/modules/content_translation/content_translation.libraries.yml @@ -9,3 +9,9 @@ drupal.content_translation.admin: - core/jquery - core/drupal - core/jquery.once + +drupal.content_translation.node: + version: VERSION + css: + theme: + css/content_translation.node.css: {} diff --git a/core/modules/content_translation/css/content_translation.node.css b/core/modules/content_translation/css/content_translation.node.css index e69de29..420e875 100644 --- a/core/modules/content_translation/css/content_translation.node.css +++ b/core/modules/content_translation/css/content_translation.node.css @@ -0,0 +1,15 @@ +/** + * @file + * Styles for the field that use all languages suffix. + */ + +label { + width: 100%; +} +.translation-entity-title { + float: left; +} +.translation-entity-all-languages { + float: right; + font-weight: 300; +} \ No newline at end of file diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php index b619036..b2e9b31 100644 --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@ -346,7 +346,7 @@ protected function addTranslatabilityClue(&$element) { // Elements which can have a #title attribute according to FAPI Reference. if (!isset($suffix)) { - $suffix = ' (' . t('all languages') . ')'; + $suffix = ' ' . t('all languages') . ''; $fapi_title_elements = array_flip(array('checkbox', 'checkboxes', 'date', 'details', 'fieldset', 'file', 'item', 'password', 'password_confirm', 'radio', 'radios', 'select', 'text_format', 'textarea', 'textfield', 'weight')); } @@ -355,17 +355,21 @@ protected function addTranslatabilityClue(&$element) { // check is because some elements have a #title attribute even though it is // not rendered, e.g. field containers. if (isset($element['#type']) && isset($fapi_title_elements[$element['#type']]) && isset($element['#title'])) { + $element['#attached']['library'][] = 'content_translation/drupal.content_translation.node'; + $element['#title'] = '' . $element['#title'] . ''; $element['#title'] .= $suffix; } // If the current element does not have a (valid) title, try child elements. elseif ($children = Element::children($element)) { foreach ($children as $delta) { - $this->addTranslatabilityClue($element[$delta], $suffix); + $this->addTranslatabilityClue($element[$delta]); } } // If there are no children, fall back to the current #title attribute if it // exists. elseif (isset($element['#title'])) { + $element['#attached']['library'][] = 'content_translation/drupal.content_translation.node'; + $element['#title'] = '' . $element['#title'] . ''; $element['#title'] .= $suffix; } }