Commit bf28ded5 authored by alexpott's avatar alexpott
Browse files

Issue #2321341 by blueminds: Fixed EntityAccessControlHandler::createAccess()...

Issue #2321341 by blueminds: Fixed EntityAccessControlHandler::createAccess() does not pass into the hooks the entity bundle.
parent 7f2710be
...@@ -220,8 +220,8 @@ public function createAccess($entity_bundle = NULL, AccountInterface $account = ...@@ -220,8 +220,8 @@ public function createAccess($entity_bundle = NULL, AccountInterface $account =
// - No modules say to deny access. // - No modules say to deny access.
// - At least one module says to grant access. // - At least one module says to grant access.
$access = array_merge( $access = array_merge(
$this->moduleHandler()->invokeAll('entity_create_access', array($account, $context['langcode'])), $this->moduleHandler()->invokeAll('entity_create_access', array($account, $context, $entity_bundle)),
$this->moduleHandler()->invokeAll($this->entityTypeId . '_create_access', array($account, $context['langcode'])) $this->moduleHandler()->invokeAll($this->entityTypeId . '_create_access', array($account, $context, $entity_bundle))
); );
if (($return = $this->processAccessHookResults($access)) === NULL) { if (($return = $this->processAccessHookResults($access)) === NULL) {
......
...@@ -564,8 +564,12 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o ...@@ -564,8 +564,12 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o
* *
* @param \Drupal\Core\Session\AccountInterface $account * @param \Drupal\Core\Session\AccountInterface $account
* The account trying to access the entity. * The account trying to access the entity.
* @param string $langcode * @param array $context
* The code of the language $entity is accessed in. * An associative array of additional context values. By default it contains
* language:
* - langcode - the current language code.
* @param string $entity_bundle
* The entity bundle name.
* *
* @return bool|null * @return bool|null
* A boolean to explicitly allow or deny access, or NULL to neither allow nor * A boolean to explicitly allow or deny access, or NULL to neither allow nor
...@@ -577,7 +581,7 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o ...@@ -577,7 +581,7 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o
* *
* @ingroup entity_api * @ingroup entity_api
*/ */
function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $account, $langcode) { function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $account, array $context, $entity_bundle) {
return NULL; return NULL;
} }
...@@ -586,8 +590,12 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun ...@@ -586,8 +590,12 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun
* *
* @param \Drupal\Core\Session\AccountInterface $account * @param \Drupal\Core\Session\AccountInterface $account
* The account trying to access the entity. * The account trying to access the entity.
* @param string $langcode * @param array $context
* The code of the language $entity is accessed in. * An associative array of additional context values. By default it contains
* language:
* - langcode - the current language code.
* @param string $entity_bundle
* The entity bundle name.
* *
* @return bool|null * @return bool|null
* A boolean to explicitly allow or deny access, or NULL to neither allow nor * A boolean to explicitly allow or deny access, or NULL to neither allow nor
...@@ -599,7 +607,7 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun ...@@ -599,7 +607,7 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun
* *
* @ingroup entity_api * @ingroup entity_api
*/ */
function hook_ENTITY_TYPE_create_access(\Drupal\Core\Session\AccountInterface $account, $langcode) { function hook_ENTITY_TYPE_create_access(\Drupal\Core\Session\AccountInterface $account, array $context, $entity_bundle) {
return NULL; return NULL;
} }
......
...@@ -487,13 +487,13 @@ function entity_test_entity_test_access(EntityInterface $entity, $operation, Acc ...@@ -487,13 +487,13 @@ function entity_test_entity_test_access(EntityInterface $entity, $operation, Acc
/** /**
* Implements hook_entity_create_access(). * Implements hook_entity_create_access().
*/ */
function entity_test_entity_create_access(AccountInterface $account, $langcode) { function entity_test_entity_create_access(AccountInterface $account, $context, $entity_bundle) {
\Drupal::state()->set('entity_test_entity_create_access', TRUE); \Drupal::state()->set('entity_test_entity_create_access', TRUE);
} }
/** /**
* Implements hook_ENTITY_TYPE_create_access(). * Implements hook_ENTITY_TYPE_create_access().
*/ */
function entity_test_entity_test_create_access(AccountInterface $account, $langcode) { function entity_test_entity_test_create_access(AccountInterface $account, $context, $entity_bundle) {
\Drupal::state()->set('entity_test_entity_test_create_access', TRUE); \Drupal::state()->set('entity_test_entity_test_create_access', TRUE);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment