// Always associate the list cache tag, otherwise the cached empty result
// wouldn't be invalidated. This would continue to show nothing matches the
// query, even though a newly created entity might match the query.
$cache_tags = Cache::
mergeTags($cache_tags,
$entity_type_definition->
getListCacheTags());
return [ '#theme' => 'item_list',
'#items' =>
$labels,
'#title' =>
$entity_type_id . ' entities',
'#cache' =>
[ 'contexts' =>
$entity_type_definition->
getListCacheContexts(),
'tags' =>
$cache_tags,
],
];
} /**
* 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.
*
* @param string $entity_type_id
* The type of the entity being listed.
*
* @return array
* A renderable array.
*/