protected function EntityToTableRenderer::getTableColumns in Reference Table Formatter 8
Same name and namespace in other branches
- 2.0.x src/EntityToTableRenderer.php \Drupal\reference_table_formatter\EntityToTableRenderer::getTableColumns()
Get the fields which will appear in the table.
Parameters
array $rendered_entities: All of the entities which will be shown on the table.
Return value
array The fields to render keyed by name with the title as the value.
1 call to EntityToTableRenderer::getTableColumns()
- EntityToTableRenderer::getTable in src/
EntityToTableRenderer.php - Render the entities to a table.
File
- src/
EntityToTableRenderer.php, line 163
Class
- EntityToTableRenderer
- A service for turning entities into tables.
Namespace
Drupal\reference_table_formatterCode
protected function getTableColumns(array $rendered_entities) {
$table_fields = array_merge(...$rendered_entities);
uasort($table_fields, 'Drupal\\Component\\Utility\\SortArray::sortByWeightProperty');
// Flatten to mapping of field name to field label.
foreach ($table_fields as $field) {
$table_fields[$field['#field_name']] = $field['#title'];
}
return $table_fields;
}