diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 772194e..46e5768 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1625,11 +1625,10 @@ function node_access($op, $node, $account = NULL, $langcode = NULL) { return $access_controller->createAccess($bundle, $account, array('langcode' => $langcode)); } - // If no language code was provided, default to the node's langcode. - if (empty($langcode)) { - $langcode = $node->prepareLangcode(); + if ($langcode) { + $node = $node->getTranslation($langcode); } - return $access_controller->access($node->getTranslation($langcode), $op, $account); + return $access_controller->access($node, $op, $account); } /** diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index 9ca18e7..1a70930 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -534,27 +534,27 @@ function entity_test_entity_prepare_view($entity_type, array $entities, array $d /** * Implements hook_entity_access(). */ -function entity_test_entity_access(EntityInterface $entity, $operation, AccountInterface $account, $langcode) { +function entity_test_entity_access(EntityInterface $entity, $operation, AccountInterface $account) { \Drupal::state()->set('entity_test_entity_access', TRUE); } /** * Implements hook_ENTITY_TYPE_access(). */ -function entity_test_entity_test_access(EntityInterface $entity, $operation, AccountInterface $account, $langcode) { +function entity_test_entity_test_access(EntityInterface $entity, $operation, AccountInterface $account) { \Drupal::state()->set('entity_test_entity_test_access', TRUE); } /** * Implements hook_entity_create_access(). */ -function entity_test_entity_create_access(AccountInterface $account, $langcode) { +function entity_test_entity_create_access(AccountInterface $account) { \Drupal::state()->set('entity_test_entity_create_access', TRUE); } /** * 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) { \Drupal::state()->set('entity_test_entity_test_create_access', TRUE); }