diff core/lib/Drupal/Core/Entity/EntityCreateAnyAccessCheck.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/lib/Drupal/Core/Entity/EntityCreateAnyAccessCheck.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/lib/Drupal/Core/Entity/EntityCreateAnyAccessCheck.php	Thu Feb 28 13:21:36 2019 +0000
@@ -78,13 +78,15 @@
     if ($entity_type->getBundleEntityType()) {
       $access->addCacheTags($this->entityTypeManager->getDefinition($entity_type->getBundleEntityType())->getListCacheTags());
 
-      // Check if the user is allowed to create new bundles. If so, allow
-      // access, so the add page can show a link to create one.
-      // @see \Drupal\Core\Entity\Controller\EntityController::addPage()
-      $bundle_access_control_handler = $this->entityTypeManager->getAccessControlHandler($entity_type->getBundleEntityType());
-      $access = $access->orIf($bundle_access_control_handler->createAccess(NULL, $account, [], TRUE));
-      if ($access->isAllowed()) {
-        return $access;
+      if (empty($route->getOption('_ignore_create_bundle_access'))) {
+        // Check if the user is allowed to create new bundles. If so, allow
+        // access, so the add page can show a link to create one.
+        // @see \Drupal\Core\Entity\Controller\EntityController::addPage()
+        $bundle_access_control_handler = $this->entityTypeManager->getAccessControlHandler($entity_type->getBundleEntityType());
+        $access = $access->orIf($bundle_access_control_handler->createAccess(NULL, $account, [], TRUE));
+        if ($access->isAllowed()) {
+          return $access;
+        }
       }
     }