$nonempty_entity_listing_url = Url::
fromRoute('entity.entity_test.collection_labels_alphabetically',
['entity_type_id' =>
$entity_type]);
// The default cache contexts for rendered entities.
$default_cache_contexts =
['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'
];
$entity_cache_contexts = Cache::
mergeContexts($default_cache_contexts,
['url.site'
]);
$page_cache_contexts = Cache::
mergeContexts($default_cache_contexts,
['url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT
]);
// Cache tags present on every rendered page.
// 'user.permissions' is a required cache context, and responses that vary
// by this cache context when requested by anonymous users automatically
// also get this cache tag, to ensure correct invalidation.
$page_cache_tags = Cache::
mergeTags(['http_response', 'rendered'
],
['config:user.role.anonymous'
]);
// If the block module is used, the Block page display variant is used,
// which adds the block config entity type's list cache tags.
$page_cache_tags = Cache::
mergeTags($page_cache_tags, \Drupal::
moduleHandler()->
moduleExists('block'
) ?
['config:block_list'
] :
[]);
$page_cache_tags_referencing_entity =
in_array('user.permissions',
$this->
getAccessCacheContextsForEntity($this->referencingEntity
)) ?
['config:user.role.anonymous'
] :
[];
$view_cache_tag =
[];
if ($this->entity->
getEntityType()->
hasHandlerClass('view_builder'
)) { $view_cache_tag = \Drupal::
entityTypeManager()->
getViewBuilder($entity_type) ->
getCacheTags();
}