Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DisplayPluginBase.php

function DisplayPluginBase::getFieldLabels

Overrides DisplayPluginInterface::getFieldLabels

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 975

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function getFieldLabels($groupable_only = FALSE) {
    $options = [];
    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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal