From 771adc482623a56cd68d061aa0f1146c6d162650 Mon Sep 17 00:00:00 2001 From: Lee Rowlands <lee.rowlands@previousnext.com.au> Date: Tue, 6 Aug 2019 16:39:06 +1000 Subject: [PATCH] Issue #2825516 by mikelutz, amwhalen, jhedstrom, pwolanin, ragnarkurm: hook_node_access() is called with $op = 'delete' when the create node form is shown --- core/modules/node/src/NodeForm.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index f5380846b7e1..9ae4c198dd03 100644 --- a/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -251,8 +251,9 @@ protected function actions(array $form, FormStateInterface $form_state) { '#submit' => ['::submitForm', '::preview'], ]; - $element['delete']['#access'] = $node->access('delete'); - $element['delete']['#weight'] = 100; + if (array_key_exists('delete', $element)) { + $element['delete']['#weight'] = 100; + } return $element; } -- GitLab