diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 30dc09b..b39e51c 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -2157,39 +2157,40 @@ function node_form_system_themes_admin_form_submit($form, &$form_state) { function node_access($op, $node, $account = NULL, $langcode = NULL) { $access_controller = Drupal::entityManager()->getAccessController('node'); - if (!$node instanceof EntityInterface) { - $node = entity_create('node', array('type' => $node)); - $access_controller->createAccess($node, ) - $access_controller = entity_access_controller('node'); - } - elseif ($node instanceof NodeTypeInterface) { - $node = entity_create('node', array('type' => $node->id())); + if ($op == 'crate') { + if (!$node instanceof EntityInterface) { + $bundle = $node; + } + elseif ($node instanceof NodeTypeInterface) { + $bundle = $node->id(); + } } - // If no language code was provided, default to the node's langcode. - if (empty($langcode)) { - $langcode = $node->langcode; - // If the Language module is enabled, try to use the language from content - // negotiation. - if (module_exists('language')) { - // Load languages the node exists in. - $node_translations = $node->getTranslationLanguages(); - // Load the language from content negotiation. - $content_negotiation_langcode = language(Language::TYPE_CONTENT)->id; - // If there is a translation available, use it. - if (isset($node_translations[$content_negotiation_langcode])) { - $langcode = $content_negotiation_langcode; + else { + // If no language code was provided, default to the node's langcode. + if (empty($langcode)) { + $langcode = $node->langcode; + // If the Language module is enabled, try to use the language from content + // negotiation. + if (module_exists('language')) { + // Load languages the node exists in. + $node_translations = $node->getTranslationLanguages(); + // Load the language from content negotiation. + $content_negotiation_langcode = language(Language::TYPE_CONTENT)->id; + // If there is a translation available, use it. + if (isset($node_translations[$content_negotiation_langcode])) { + $langcode = $content_negotiation_langcode; + } } } } - // Make sure that if an account is passed, that it is a fully loaded user - // object. - if ($account && !($account instanceof UserInterface)) { - $account = user_load($account->uid); + if ($op == 'create') { + return $access_controller->createAccess($bundle, $langcode, $account); + } + else { + return $access_controller->access($node, $op, $langcode, $account); } - - return $access_controller->access($node, $op, $langcode, $account); } /**