Part of #1971384: [META] Convert page callbacks to controllers

For instructions on how to convert a page callback into a controller, see the WSCCI Conversion Guide.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett
Status: Active » Needs review
Issue tags: +FormInterface
FileSize
3.25 KB

Sometimes it's just too easy.

jibran’s picture

Status: Needs review » Reviewed & tested by the community

This is beautiful RTBC if green.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, node-1987766-1.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
4.08 KB
850 bytes

/me shakes fist at EntityBCDecorator.

jibran’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -WSCCI-conversion

This is beautiful RTBC if green.

hehe

jibran’s picture

Issue tags: +WSCCI-conversion

:/

Status: Reviewed & tested by the community » Needs work

The last submitted patch, node-1987766-4.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
4.85 KB

Borrowing berdir's fix from #1947880-17: Replace node_access() by $entity->access().

diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php
index ec68b7e..c636ebb 100644
--- a/core/modules/node/lib/Drupal/node/NodeAccessController.php
+++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php
@@ -113,7 +113,7 @@ protected function accessGrants(EntityInterface $node, $operation, $langcode = L
     $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.
jibran’s picture

Status: Needs review » Reviewed & tested by the community

Its green. Edit page works fine. It is ready now.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a reroll

curl https://drupal.org/files/node-1987766-8.patch | git a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4963  100  4963    0     0   4835      0  0:00:01  0:00:01 --:--:--  5811
error: core/modules/node/node.routing.yml: already exists in index
jibran’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll
FileSize
4.99 KB

Reroll
Conflict

++<<<<<<< HEAD
 +node_multiple_delete_confirm:
 +  pattern: '/admin/content/node/delete'
 +  defaults:
 +    _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'
++>>>>>>> 8

Resolved

+node_multiple_delete_confirm:
 +  pattern: '/admin/content/node/delete'
 +  defaults:
 +    _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'

Back to RTBC as no change in code.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2581366 and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.