You are here

public function YamlFormSubmissionListBuilder::buildHeader in YAML Form 8

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 YamlFormSubmissionListBuilder::buildHeader()
YamlFormSubmissionListBuilder::getEntityIds in src/YamlFormSubmissionListBuilder.php
Loads entity IDs using a pager sorted by the entity id.

File

src/YamlFormSubmissionListBuilder.php, line 244

Class

YamlFormSubmissionListBuilder
Provides a list controller for yamlform submission entity.

Namespace

Drupal\yamlform

Code

public function buildHeader() {
  if (isset($this->header)) {
    return $this->header;
  }
  $responsive_priorities = [
    'created' => RESPONSIVE_PRIORITY_MEDIUM,
    'langcode' => RESPONSIVE_PRIORITY_LOW,
    'remote_addr' => RESPONSIVE_PRIORITY_LOW,
    'uid' => RESPONSIVE_PRIORITY_MEDIUM,
    'yamlform' => RESPONSIVE_PRIORITY_LOW,
  ];
  $header = [];
  foreach ($this->columns as $column_name => $column) {
    $header[$column_name] = $this
      ->buildHeaderColumn($column);

    // Apply custom sorting to header.
    if ($column_name === $this->sort) {
      $header[$column_name]['sort'] = $this->direction;
    }

    // Apply responsive priorities to header.
    if (isset($responsive_priorities[$column_name])) {
      $header[$column_name]['class'][] = $responsive_priorities[$column_name];
    }
  }
  $this->header = $header;
  return $this->header;
}