function views_plugin_display::get_field_labels
List of fields for the current display with the associated relationship.
Parameters
bool $groupable_only: Return only an array of field labels from handler that return TRUE from use_string_group_by method.
File
-
plugins/
views_plugin_display.inc, line 1084
Class
- views_plugin_display
- The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.
Code
public function get_field_labels() {
// Use func_get_arg so the function signature isn't amended but we can still
// pass TRUE into the function to filter by groupable handlers.
$args = func_get_args();
$groupable_only = isset($args[0]) ? $args[0] : FALSE;
$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 ($groupable_only && !$handler->use_string_group_by()) {
// Continue to next handler if it's not groupable.
continue;
}
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;
}