Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
306
Merge Requests
306
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
25813669
Commit
25813669
authored
Jun 10, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1987766
by tim.plunkett, jibran: Convert node_page_edit() to a new style controller.
parent
e41c6e15
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
24 deletions
+15
-24
core/lib/Drupal/Core/Entity/EntityAccessController.php
core/lib/Drupal/Core/Entity/EntityAccessController.php
+1
-1
core/modules/node/lib/Drupal/node/NodeAccessController.php
core/modules/node/lib/Drupal/node/NodeAccessController.php
+1
-1
core/modules/node/lib/Drupal/node/NodeFormController.php
core/modules/node/lib/Drupal/node/NodeFormController.php
+4
-0
core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php
.../modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php
+2
-1
core/modules/node/node.module
core/modules/node/node.module
+1
-5
core/modules/node/node.pages.inc
core/modules/node/node.pages.inc
+0
-16
core/modules/node/node.routing.yml
core/modules/node/node.routing.yml
+6
-0
No files found.
core/lib/Drupal/Core/Entity/EntityAccessController.php
View file @
25813669
...
...
@@ -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
;
...
...
core/modules/node/lib/Drupal/node/NodeAccessController.php
View file @
25813669
...
...
@@ -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.
...
...
core/modules/node/lib/Drupal/node/NodeFormController.php
View file @
25813669
...
...
@@ -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'
]))
{
...
...
core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php
View file @
25813669
...
...
@@ -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"
* },
...
...
core/modules/node/node.module
View file @
25813669
...
...
@@ -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'
,
...
...
core/modules/node/node.pages.inc
View file @
25813669
...
...
@@ -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.
*
...
...
core/modules/node/node.routing.yml
View file @
25813669
...
...
@@ -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'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment