You are here

public function MediaListBuilder::buildHeader in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/MediaListBuilder.php \Drupal\media\MediaListBuilder::buildHeader()
  2. 9 core/modules/media/src/MediaListBuilder.php \Drupal\media\MediaListBuilder::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()

File

core/modules/media/src/MediaListBuilder.php, line 78

Class

MediaListBuilder
Provides a listing of media items.

Namespace

Drupal\media

Code

public function buildHeader() {
  $header = [];
  if ($this->thumbnailStyleExists) {
    $header['thumbnail'] = [
      'data' => $this
        ->t('Thumbnail'),
      'class' => [
        RESPONSIVE_PRIORITY_LOW,
      ],
    ];
  }
  $header += [
    'name' => $this
      ->t('Media Name'),
    'type' => [
      'data' => $this
        ->t('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,
      ],
    ],
  ];

  // Enable language column if multiple languages are added.
  if ($this->languageManager
    ->isMultilingual()) {
    $header['language'] = [
      'data' => $this
        ->t('Language'),
      'class' => [
        RESPONSIVE_PRIORITY_LOW,
      ],
    ];
  }
  return $header + parent::buildHeader();
}