function NodeListBuilder::buildHeader

Same name in other branches
  1. 8.9.x core/modules/node/src/NodeListBuilder.php \Drupal\node\NodeListBuilder::buildHeader()
  2. 10 core/modules/node/src/NodeListBuilder.php \Drupal\node\NodeListBuilder::buildHeader()
  3. 11.x core/modules/node/src/NodeListBuilder.php \Drupal\node\NodeListBuilder::buildHeader()

Overrides EntityListBuilder::buildHeader

1 call to NodeListBuilder::buildHeader()
ModeratedNodeListBuilder::buildHeader in core/modules/content_moderation/src/ModeratedNodeListBuilder.php
Builds the header row for the entity listing.
1 method overrides NodeListBuilder::buildHeader()
ModeratedNodeListBuilder::buildHeader in core/modules/content_moderation/src/ModeratedNodeListBuilder.php
Builds the header row for the entity listing.

File

core/modules/node/src/NodeListBuilder.php, line 61

Class

NodeListBuilder
Defines a class to build a listing of node entities.

Namespace

Drupal\node

Code

public function buildHeader() {
    // Enable language column and filter if multiple languages are added.
    $header = [
        'title' => $this->t('Title'),
        'type' => [
            'data' => $this->t('Content type'),
            'class' => [
                RESPONSIVE_PRIORITY_MEDIUM,
            ],
        ],
        'author' => [
            'data' => $this->t('Author'),
            'class' => [
                RESPONSIVE_PRIORITY_LOW,
            ],
        ],
        'status' => $this->t('Status'),
        'changed' => [
            'data' => $this->t('Updated'),
            'class' => [
                RESPONSIVE_PRIORITY_LOW,
            ],
        ],
    ];
    if (\Drupal::languageManager()->isMultilingual()) {
        $header['language_name'] = [
            'data' => $this->t('Language'),
            'class' => [
                RESPONSIVE_PRIORITY_LOW,
            ],
        ];
    }
    return $header + parent::buildHeader();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.