You are here

function views_plugin_display::get_field_labels in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_display.inc \views_plugin_display::get_field_labels()
  2. 7.3 plugins/views_plugin_display.inc \views_plugin_display::get_field_labels()

Retrieve a list of fields for the current display with the relationship associated if it exists.

File

plugins/views_plugin_display.inc, line 895
Contains the base display plugin.

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

function get_field_labels() {
  $options = array();
  foreach ($this
    ->get_handlers('relationship') as $relationship => $handler) {
    if ($label = $handler
      ->label()) {
      $relationships[$relationship] = $label;
    }
    else {
      $relationships[$relationship] = $handler
        ->ui_name();
    }
  }
  foreach ($this
    ->get_handlers('field') as $id => $handler) {
    if ($label = $handler
      ->label()) {
      $options[$id] = $label;
    }
    else {
      $options[$id] = $handler
        ->ui_name();
    }
    if (!empty($handler->options['relationship']) && !empty($relationships[$handler->options['relationship']])) {
      $options[$id] = '(' . $relationships[$handler->options['relationship']] . ') ' . $options[$id];
    }
  }
  return $options;
}