You are here

function field_display_label_preprocess_field in Field Display Label 7

Same name and namespace in other branches
  1. 8 field_display_label.module \field_display_label_preprocess_field()

Implements hook_preprocess_field().

File

./field_display_label.module, line 27
Main file for Field Display Label module.

Code

function field_display_label_preprocess_field(&$variables) {
  $field = field_info_instance($variables['element']['#entity_type'], $variables['element']['#field_name'], $variables['element']['#bundle']);
  if (isset($field['display_label']) && strlen(trim($field['display_label'])) > 0) {
    if (module_exists('i18n_field')) {
      $variables['label'] = check_plain(i18n_field_translate_property($field, 'display_label'));
    }
    else {
      $variables['label'] = check_plain($field['display_label']);
    }
  }
}