'textfield', '#title' => t('Display label'), '#description' => t('A separate label for viewing this field. Leave blank to use the default field label.'), '#default_value' => isset($form['#instance']['display_label']) ? $form['#instance']['display_label'] : '', '#weight' => $form['instance']['label']['#weight'] + 1, ); } /** * Implementation of hook_field_display_alter */ function field_display_label_theme_registry_alter(&$theme_registry) { $theme_registry['field']['preprocess functions'][] = 'field_display_label_preprocess_field'; } /** * Preprocess function to replace the regular label with the display label */ 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) { $variables['label'] = $field['display_label']; } }