Retrieves a list of fields for the current display.
This also takes into account any associated relationships, if they exist.
bool $groupable_only: (optional) TRUE to only return an array of field labels from handlers that support the useStringGroupBy method, defaults to FALSE.
array An array of applicable field options, keyed by ID.
public function getFieldLabels($groupable_only = FALSE) {
$options = array();
foreach ($this
->getHandlers('relationship') as $relationship => $handler) {
$relationships[$relationship] = $handler
->adminLabel();
}
foreach ($this
->getHandlers('field') as $id => $handler) {
if ($groupable_only && !$handler
->useStringGroupBy()) {
// Continue to next handler if it's not groupable.
continue;
}
if ($label = $handler
->label()) {
$options[$id] = $label;
}
else {
$options[$id] = $handler
->adminLabel();
}
if (!empty($handler->options['relationship']) && !empty($relationships[$handler->options['relationship']])) {
$options[$id] = '(' . $relationships[$handler->options['relationship']] . ') ' . $options[$id];
}
}
return $options;
}