summaryrefslogtreecommitdiffstats
path: root/core/modules/node/src/NodeForm.php
diff options
context:
space:
mode:
authorAlex Pott2017-01-03 13:06:01 (GMT)
committerAlex Pott2017-01-03 13:06:01 (GMT)
commit26ae527f293f200229bfca5608e2329a79198e27 (patch)
tree0e838463fbe9368dd36f9075e1d9193e74ec1821 /core/modules/node/src/NodeForm.php
parent6b7acf7d3c608a5348324db35d14a1e88a664fe9 (diff)
Revert "Issue #2325463 by claudiu.cristea, swentel, GroovyCarrot, bircher, aloknarwaria, lokapujya, Berdir, mohit_aghera, yanniboi, mgifford, BarisW, Yogesh Pawar: Destination URL breaks preview"
This reverts commit c7da19c9c38f0faeac24a63ab25fdda17b8b3db6.
Diffstat (limited to 'core/modules/node/src/NodeForm.php')
-rw-r--r--core/modules/node/src/NodeForm.php22
1 files changed, 9 insertions, 13 deletions
diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php
index 216044a..3a9ed54 100644
--- a/core/modules/node/src/NodeForm.php
+++ b/core/modules/node/src/NodeForm.php
@@ -23,6 +23,11 @@ class NodeForm extends ContentEntityForm {
protected $tempStoreFactory;
/**
+ * Whether this node has been previewed or not.
+ */
+ protected $hasBeenPreviewed = FALSE;
+
+ /**
* Constructs a NodeForm object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
@@ -79,7 +84,7 @@ class NodeForm extends ContentEntityForm {
$this->entity = $preview->getFormObject()->getEntity();
$this->entity->in_preview = NULL;
- $form_state->set('has_been_previewed', TRUE);
+ $this->hasBeenPreviewed = TRUE;
}
/** @var \Drupal\node\NodeInterface $node */
@@ -181,7 +186,7 @@ class NodeForm extends ContentEntityForm {
$node = $this->entity;
$preview_mode = $node->type->entity->getPreviewMode();
- $element['submit']['#access'] = $preview_mode != DRUPAL_REQUIRED || $form_state->get('has_been_previewed');
+ $element['submit']['#access'] = $preview_mode != DRUPAL_REQUIRED || $this->hasBeenPreviewed;
// If saving is an option, privileged users get dedicated form submit
// buttons to adjust the publishing status while saving in one go.
@@ -262,19 +267,10 @@ class NodeForm extends ContentEntityForm {
$store = $this->tempStoreFactory->get('node_preview');
$this->entity->in_preview = TRUE;
$store->set($this->entity->uuid(), $form_state);
-
- $route_parameters = [
+ $form_state->setRedirect('entity.node.preview', array(
'node_preview' => $this->entity->uuid(),
'view_mode_id' => 'default',
- ];
-
- $options = [];
- $query = $this->getRequest()->query;
- if ($query->has('destination')) {
- $options['query']['destination'] = $query->get('destination');
- $query->remove('destination');
- }
- $form_state->setRedirect('entity.node.preview', $route_parameters, $options);
+ ));
}
/**