function EntityAccessControlHandler::buildCreateAccessCid
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php \Drupal\Core\Entity\EntityAccessControlHandler::buildCreateAccessCid()
Builds the create access result cache ID.
If there is no context other than langcode and entity type id, then the cache id can be simply the bundle. Otherwise, a custom implementation is needed to ensure cacheability, and the default implementation here returns null.
Parameters
array $context: The create access context.
string|null $entity_bundle: The entity bundle, if the entity type has bundles.
Return value
string|null The create access result cache ID, or null if uncacheable.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityAccessControlHandler.php, line 425
Class
- EntityAccessControlHandler
- Defines a default implementation for entity access control handler.
Namespace
Drupal\Core\EntityCode
protected function buildCreateAccessCid(array $context, ?string $entity_bundle) : ?string {
$extendedContext = array_filter($context, function ($key) {
return !in_array($key, [
'entity_type_id',
'langcode',
]);
}, ARRAY_FILTER_USE_KEY);
if (empty($extendedContext)) {
return $entity_bundle ? 'create:' . $entity_bundle : 'create';
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.