public function EntityTypeInfoController::entityTypeList in Devel 8
Same name and namespace in other branches
- 8.3 src/Controller/EntityTypeInfoController.php \Drupal\devel\Controller\EntityTypeInfoController::entityTypeList()
- 8.2 src/Controller/EntityTypeInfoController.php \Drupal\devel\Controller\EntityTypeInfoController::entityTypeList()
- 4.x src/Controller/EntityTypeInfoController.php \Drupal\devel\Controller\EntityTypeInfoController::entityTypeList()
Builds the entity types overview page.
Return value
array A render array as expected by the renderer.
1 string reference to 'EntityTypeInfoController::entityTypeList'
File
- src/
Controller/ EntityTypeInfoController.php, line 49
Class
- EntityTypeInfoController
- Provides route responses for the entity types info page.
Namespace
Drupal\devel\ControllerCode
public function entityTypeList() {
$headers = [
$this
->t('ID'),
$this
->t('Name'),
$this
->t('Provider'),
$this
->t('Class'),
$this
->t('Operations'),
];
$rows = [];
foreach ($this
->entityTypeManager()
->getDefinitions() as $entity_type_id => $entity_type) {
$row['id'] = [
'data' => $entity_type
->id(),
'class' => 'table-filter-text-source',
];
$row['name'] = [
'data' => $entity_type
->getLabel(),
'class' => 'table-filter-text-source',
];
$row['provider'] = [
'data' => $entity_type
->getProvider(),
'class' => 'table-filter-text-source',
];
$row['class'] = [
'data' => $entity_type
->getClass(),
'class' => 'table-filter-text-source',
];
$row['operations']['data'] = [
'#type' => 'operations',
'#links' => [
'devel' => [
'title' => $this
->t('Devel'),
'url' => Url::fromRoute('devel.entity_info_page.detail', [
'entity_type_id' => $entity_type_id,
]),
'attributes' => [
'class' => [
'use-ajax',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => 700,
'minHeight' => 500,
]),
],
],
],
];
$rows[$entity_type_id] = $row;
}
ksort($rows);
$output['#attached']['library'][] = 'system/drupal.system.modules';
$output['filters'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'table-filter',
'js-show',
],
],
];
$output['filters']['text'] = [
'#type' => 'search',
'#title' => $this
->t('Search'),
'#size' => 30,
'#placeholder' => $this
->t('Enter entity type id, provider or class'),
'#attributes' => [
'class' => [
'table-filter-text',
],
'data-table' => '.devel-filter-text',
'autocomplete' => 'off',
'title' => $this
->t('Enter a part of the entity type id, provider or class to filter by.'),
],
];
$output['entities'] = [
'#type' => 'table',
'#header' => $headers,
'#rows' => $rows,
'#empty' => $this
->t('No entity types found.'),
'#sticky' => TRUE,
'#attributes' => [
'class' => [
'devel-entity-type-list',
'devel-filter-text',
],
],
];
return $output;
}