diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessController.php index a4bba1c..0b65523 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php @@ -45,7 +45,7 @@ public function access(EntityInterface $entity, $operation, $langcode = Language // We grant access to the entity if both of these conditions are met: // - No modules say to deny access. // - At least one module says to grant access. - $access = module_invoke_all($entity->entityType() . '_access', $entity, $operation, $account, $langcode); + $access = module_invoke_all($entity->entityType() . '_access', $entity->getBCEntity(), $operation, $account, $langcode); if (in_array(FALSE, $access, TRUE)) { $return = FALSE; diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php index 7e4f601..092d892 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -97,7 +97,7 @@ protected function accessGrants(EntityInterface $node, $operation, $langcode, Us $query->condition('grant_' . $operation, 1, '>='); // Check for grants for this node and the correct langcode. $nids = db_and() - ->condition('nid', $node->nid) + ->condition('nid', $node->id()) ->condition('langcode', $langcode); // If the node is published, also take the default grant into account. The // default is saved with a node ID of 0. diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index 4bc59fe..350b4e3 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -59,6 +59,10 @@ protected function prepareEntity() { public function form(array $form, array &$form_state) { $node = $this->entity; + if ($this->operation == 'edit') { + drupal_set_title(t('Edit @type @title', array('@type' => node_get_type_label($node), '@title' => $node->label())), PASS_THROUGH); + } + $user_config = config('user.settings'); // Some special stuff when previewing a node. if (isset($form_state['node_preview'])) { diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index fc4da34..5503100 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -25,7 +25,8 @@ * "render" = "Drupal\node\NodeRenderController", * "access" = "Drupal\node\NodeAccessController", * "form" = { - * "default" = "Drupal\node\NodeFormController" + * "default" = "Drupal\node\NodeFormController", + * "edit" = "Drupal\node\NodeFormController" * }, * "translation" = "Drupal\node\NodeTranslationController" * }, diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 30161a2..bb613eb 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1677,13 +1677,9 @@ function node_menu() { ); $items['node/%node/edit'] = array( 'title' => 'Edit', - 'page callback' => 'node_page_edit', - 'page arguments' => array(1), - 'access callback' => 'node_access', - 'access arguments' => array('update', 1), + 'route_name' => 'node_page_edit', 'type' => MENU_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, - 'file' => 'node.pages.inc', ); $items['node/%node/delete'] = array( 'title' => 'Delete', diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index d8f8d7c..85b8432 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -12,22 +12,6 @@ use Drupal\Core\Entity\EntityInterface; /** - * Page callback: Presents the node editing form. - * - * @param object $node - * A node object. - * - * @return array - * A form array as expected by drupal_render(). - * - * @see node_menu() - */ -function node_page_edit($node) { - drupal_set_title(t('Edit @type @title', array('@type' => node_get_type_label($node), '@title' => $node->label())), PASS_THROUGH); - return entity_get_form($node); -} - -/** * Page callback: Displays add content links for available content types. * * Redirects to node/add/[type] if only one content type is available. diff --git a/core/modules/node/node.routing.yml b/core/modules/node/node.routing.yml index 02e887b..ce897f5 100644 --- a/core/modules/node/node.routing.yml +++ b/core/modules/node/node.routing.yml @@ -4,3 +4,9 @@ node_multiple_delete_confirm: _form: '\Drupal\node\Form\DeleteMultiple' requirements: _permission: 'administer nodes' +node_page_edit: + pattern: '/node/{node}/edit' + defaults: + _entity_form: 'node.edit' + requirements: + _entity_access: 'node.update'