public function EntityTestController::listEntitiesEmpty in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/entity_test/src/Controller/EntityTestController.php \Drupal\entity_test\Controller\EntityTestController::listEntitiesEmpty()
Empty list of entities of the given entity type.
Empty because no entities match the query. That may seem contrived, but it is an excellent way for testing whether an entity's list cache tags are working as expected.
Parameters
string $entity_type_id: The type of the entity being listed.
Return value
array A renderable array.
1 string reference to 'EntityTestController::listEntitiesEmpty'
- entity_test.routing.yml in core/
modules/ system/ tests/ modules/ entity_test/ entity_test.routing.yml - core/modules/system/tests/modules/entity_test/entity_test.routing.yml
File
- core/
modules/ system/ tests/ modules/ entity_test/ src/ Controller/ EntityTestController.php, line 165 - Contains \Drupal\entity_test\Controller\EntityTestController.
Class
- EntityTestController
- Controller routines for entity_test routes.
Namespace
Drupal\entity_test\ControllerCode
public function listEntitiesEmpty($entity_type_id) {
$entity_type_definition = $this
->entityManager()
->getDefinition($entity_type_id);
return [
'#theme' => 'item_list',
'#items' => [],
'#cache' => [
'contexts' => $entity_type_definition
->getListCacheContexts(),
'tags' => $entity_type_definition
->getListCacheTags(),
],
];
}