You are here

public function NodeListBuilder::buildHeader in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/node/src/NodeListBuilder.php \Drupal\node\NodeListBuilder::buildHeader()
  2. 9 core/modules/node/src/NodeListBuilder.php \Drupal\node\NodeListBuilder::buildHeader()

Builds the header row for the entity listing.

Return value

array A render array structure of header strings.

Overrides EntityListBuilder::buildHeader

See also

\Drupal\Core\Entity\EntityListBuilder::render()

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();
}