function MediaListBuilder::buildHeader

Same name in other branches
  1. 9 core/modules/media/src/MediaListBuilder.php \Drupal\media\MediaListBuilder::buildHeader()
  2. 8.9.x core/modules/media/src/MediaListBuilder.php \Drupal\media\MediaListBuilder::buildHeader()
  3. 10 core/modules/media/src/MediaListBuilder.php \Drupal\media\MediaListBuilder::buildHeader()

Overrides EntityListBuilder::buildHeader

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

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