You are here

protected function YamlFormSubmissionListBuilder::buildHeaderColumn in YAML Form 8

Build table header column.

Parameters

array $column: The column.

Return value

array A renderable array containing a table header column.

Throws

\Exception Throw exception if table header column is not found.

1 call to YamlFormSubmissionListBuilder::buildHeaderColumn()
YamlFormSubmissionListBuilder::buildHeader in src/YamlFormSubmissionListBuilder.php
Builds the header row for the entity listing.

File

src/YamlFormSubmissionListBuilder.php, line 287

Class

YamlFormSubmissionListBuilder
Provides a list controller for yamlform submission entity.

Namespace

Drupal\yamlform

Code

protected function buildHeaderColumn(array $column) {
  $name = $column['name'];
  if ($this->format['header_format'] == 'key') {
    $title = isset($column['key']) ? $column['key'] : $column['name'];
  }
  else {
    $title = $column['title'];
  }
  switch ($name) {
    case 'notes':
    case 'sticky':
      return [
        'data' => new FormattableMarkup('<span class="yamlform-icon yamlform-icon-@name yamlform-icon-@name--link"></span>', [
          '@name' => $name,
        ]),
        'class' => [
          'yamlform-results__icon',
        ],
        'field' => 'sticky',
        'specifier' => 'sticky',
      ];
    default:
      if (isset($column['sort']) && $column['sort'] === FALSE) {
        return [
          'data' => $title,
        ];
      }
      else {
        return [
          'data' => $title,
          'field' => $name,
          'specifier' => $name,
        ];
      }
  }
}