Commit 25813669 authored by alexpott's avatar alexpott

Issue #1987766 by tim.plunkett, jibran: Convert node_page_edit() to a new style controller.

parent e41c6e15
......@@ -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;
......
......@@ -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.
......
......@@ -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('<em>Edit @type</em> @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'])) {
......
......@@ -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"
* },
......
......@@ -1688,13 +1688,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',
......
......@@ -11,22 +11,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('<em>Edit @type</em> @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.
*
......
......@@ -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'
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