private function Presentation::buildHeader in Filebrowser 3.x
Same name and namespace in other branches
- 8.2 src/Presentation.php \Drupal\filebrowser\Presentation::buildHeader()
1 call to Presentation::buildHeader()
File
- src/
Presentation.php, line 374
Class
Namespace
Drupal\filebrowserCode
private function buildHeader(&$header, &$unsorted_rows, $visible_columns, $column_names, $default_sort, $sort_order) {
/**
* @var \Drupal\Core\StringTranslation\TranslatableMarkup $specs
*/
foreach ($column_names as $column_name => $column_spec) {
if (isset($visible_columns[$column_name]) && $visible_columns[$column_name]) {
if ($column_name == Common::ICON) {
$header[$column_name] = [];
}
else {
if (!empty($column_spec['sortable'])) {
$header[$column_name] = [
'data' => $column_spec['title'],
'field' => $column_name,
];
}
else {
$header[$column_name] = $column_spec['title'];
}
}
}
else {
// If unused data then clean up !
if ($unsorted_rows) {
foreach ($unsorted_rows as &$row) {
unset($row[$column_name]);
}
}
}
}
$header[$default_sort]['sort'] = $sort_order;
}