diff --git a/core/modules/translation_entity/translation_entity.module b/core/modules/translation_entity/translation_entity.module index 745434b..97cd442 100644 --- a/core/modules/translation_entity/translation_entity.module +++ b/core/modules/translation_entity/translation_entity.module @@ -573,25 +573,44 @@ function translation_entity_field_extra_fields() { /** * Implements hook_form_FORM_ID_alter(). * - * Add a column to manage fields tab for a content type to show which fields are enabled for translation. + * Add a column to manage fields tab for a content type to show which fields + * are enabled for translation. */ function translation_entity_form_field_ui_field_overview_form_alter(array &$form, array &$form_state, $form_id) { + $translatable = translation_entity_enabled($form['#entity_type'], $form['#bundle']); + + // Don't add the translation column of translation is not enabled at entity + // level. + if (!$translatable) { + return; + } + // Move out the operations. We need to have the translatable field in the // column before operations. $operations = array_pop($form['fields']['#header']); $form['fields']['#header'][] = t('Translatable'); $form['fields']['#header'][] = $operations; + $non_translatable_fields = $form['#extra']; + foreach (element_children($form['fields']) as $field => $value) { if ($value != '_add_new_field') { $field = field_info_field($value); + // Filter out non translatable properties. + if (in_array($value, $non_translatable_fields)) { + $markup_text = t('n/a') . '' . t('Translation not supported') . ''; + } + else { + $markup_text = $field['translatable'] ? t('Yes') . '' . t('Translatable') . '' : '' . t('Not translatable') . ''; + } + // Move out the operations. We need to have the translatable field in the // column before operations. $operations_data = array_pop($form['fields'][$value]); $form['fields'][$value]['translatable'] = array( 'label' => array( - '#markup' => $field['translatable'] ? t('Yes') : '', + '#markup' => $markup_text, )); $form['fields'][$value][] = $operations_data; }