X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Fsrc%2FDateFormatAccessControlHandler.php;h=e56fe92a46a0eb4c493126baf1c6301fc87ca4a9;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=c9cee601ec3896630c0b0d4a6a95720dd84c7549;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/system/src/DateFormatAccessControlHandler.php b/web/core/modules/system/src/DateFormatAccessControlHandler.php index c9cee601e..e56fe92a4 100644 --- a/web/core/modules/system/src/DateFormatAccessControlHandler.php +++ b/web/core/modules/system/src/DateFormatAccessControlHandler.php @@ -14,18 +14,23 @@ use Drupal\Core\Session\AccountInterface; */ class DateFormatAccessControlHandler extends EntityAccessControlHandler { + /** + * {@inheritdoc} + */ + protected $viewLabelOperation = TRUE; + /** * {@inheritdoc} */ protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { - // There are no restrictions on viewing a date format. - if ($operation == 'view') { + // There are no restrictions on viewing the label of a date format. + if ($operation === 'view label') { return AccessResult::allowed(); } // Locked date formats cannot be updated or deleted. elseif (in_array($operation, ['update', 'delete'])) { if ($entity->isLocked()) { - return AccessResult::forbidden()->addCacheableDependency($entity); + return AccessResult::forbidden('The DateFormat config entity is locked.')->addCacheableDependency($entity); } else { return parent::checkAccess($entity, $operation, $account)->addCacheableDependency($entity);