Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
76 | 76 |
77 // Include list cache tag as access might change if more bundles are added. | 77 // Include list cache tag as access might change if more bundles are added. |
78 if ($entity_type->getBundleEntityType()) { | 78 if ($entity_type->getBundleEntityType()) { |
79 $access->addCacheTags($this->entityTypeManager->getDefinition($entity_type->getBundleEntityType())->getListCacheTags()); | 79 $access->addCacheTags($this->entityTypeManager->getDefinition($entity_type->getBundleEntityType())->getListCacheTags()); |
80 | 80 |
81 // Check if the user is allowed to create new bundles. If so, allow | 81 if (empty($route->getOption('_ignore_create_bundle_access'))) { |
82 // access, so the add page can show a link to create one. | 82 // Check if the user is allowed to create new bundles. If so, allow |
83 // @see \Drupal\Core\Entity\Controller\EntityController::addPage() | 83 // access, so the add page can show a link to create one. |
84 $bundle_access_control_handler = $this->entityTypeManager->getAccessControlHandler($entity_type->getBundleEntityType()); | 84 // @see \Drupal\Core\Entity\Controller\EntityController::addPage() |
85 $access = $access->orIf($bundle_access_control_handler->createAccess(NULL, $account, [], TRUE)); | 85 $bundle_access_control_handler = $this->entityTypeManager->getAccessControlHandler($entity_type->getBundleEntityType()); |
86 if ($access->isAllowed()) { | 86 $access = $access->orIf($bundle_access_control_handler->createAccess(NULL, $account, [], TRUE)); |
87 return $access; | 87 if ($access->isAllowed()) { |
88 return $access; | |
89 } | |
88 } | 90 } |
89 } | 91 } |
90 | 92 |
91 // Check whether an entity of any bundle may be created. | 93 // Check whether an entity of any bundle may be created. |
92 foreach ($bundles as $bundle) { | 94 foreach ($bundles as $bundle) { |