Skip to content
Snippets Groups Projects

Put each entity type table into a details element on admin/config/regional/content-language

3 files
+ 41
11
Compare changes
  • Side-by-side
  • Inline
Files
3
  • 9674e3a4
    Issue #3063343 by phenaproxima, Wim Leers, larowlan, seanB, effulgentsia: Make... · 9674e3a4
    catch authored
    Issue #3063343 by phenaproxima, Wim Leers, larowlan, seanB, effulgentsia: Make MediaLibraryState implement CacheableDependencyInterface to remove the need for hardcoding a cache context
@@ -41,17 +41,10 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) {
public function checkAccess(MediaLibraryState $state, AccountInterface $account) {
$parameters = $state->getOpenerParameters() + ['entity_id' => NULL];
$process_result = function ($result) {
if ($result instanceof RefinableCacheableDependencyInterface) {
$result->addCacheContexts(['url.query_args']);
}
return $result;
};
// Forbid access if any of the required parameters are missing.
foreach (['entity_type_id', 'bundle', 'field_name'] as $key) {
if (empty($parameters[$key])) {
return $process_result(AccessResult::forbidden("$key parameter is missing."));
return AccessResult::forbidden("$key parameter is missing.")->addCacheableDependency($state);
}
}
@@ -83,7 +76,10 @@ public function checkAccess(MediaLibraryState $state, AccountInterface $account)
// If entity-level access is denied, there's no point in continuing.
if (!$entity_access->isAllowed()) {
return $process_result($entity_access);
if ($entity_access instanceof RefinableCacheableDependencyInterface) {
$entity_access->addCacheableDependency($state);
}
return $entity_access;
}
// If the entity has not been loaded, create it in memory now.
@@ -107,7 +103,11 @@ public function checkAccess(MediaLibraryState $state, AccountInterface $account)
}
$field_access = $access_handler->fieldAccess('edit', $field_definition, $account, $items, TRUE);
return $process_result($entity_access->andIf($field_access));
$access = $entity_access->andIf($field_access);
if ($access instanceof RefinableCacheableDependencyInterface) {
$access->addCacheableDependency($state);
}
return $access;
}
/**
Loading