You are here

function entity_translation_element_translatability_clue in Entity Translation 7

Adds visual clues about the translatability of a field to the given element.

Field titles are appended with the string "Shared" for fields which are shared between different translations. Moreover fields receive a CSS class to distinguish between translatable and shared fields.

1 string reference to 'entity_translation_element_translatability_clue'
EntityTranslationDefaultHandler::entityFormSharedElements in includes/translation.handler.inc
Either remove access or add a translatability clue depending on the current user's "edit translation shared fields" permissions.

File

./entity_translation.module, line 1413

Code

function entity_translation_element_translatability_clue($element) {

  // Append language to element title.
  if (empty($element['#multilingual'])) {
    _entity_translation_element_title_append($element, ' (' . t('all languages') . ')');
  }

  // Add CSS class names.
  if (!isset($element['#attributes'])) {
    $element['#attributes'] = array();
  }
  if (!isset($element['#attributes']['class'])) {
    $element['#attributes']['class'] = array();
  }
  $element['#attributes']['class'][] = 'entity-translation-' . (!empty($element['#multilingual']) ? 'field-translatable' : 'field-shared');
  return $element;
}