Showing posts with label drupal8. Show all posts
Showing posts with label drupal8. Show all posts

Friday, 29 April 2016

Drupal 8 - Redirect page

use Symfony\Component\HttpFoundation\Request;

$file_url = Url::fromRoute('entity.node.canonical',  array('node' => 4071))->toString();
\Drupal::request()->query->set('destination',$file_url);

or

$file_url = Url::fromRoute('entity.node.canonical',  array('node' => 4071))->toString();
$response = new RedirectResponse($file_url);
$response->send();
return;

or

$file_url = Url::fromRoute('entity.node.canonical', array('node' => 4071));
$form_state->setRedirectUrl($file_url);