Redirect node form to view after submit I have a view for a Drupal 8 site that uses 'work' as its path. I want to redirect user to this path right after the node has been submitted. 

Form alter seems to be the right solution as it was in Drupal 7, but it's more complicated then it was before. In Drupal 7 we just used a direct path and redirect took place; now we need to provide a route name which isn't that obvious anymore. How do we find proper route name value? It's different for nodes, views, custom paths etc.

What I should use as argument for $form_state-&gt;setRedirect('')? How do I find what route name I should use in different cases?

function work_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface\FormStateInterface $form_state, $form_id) {
  switch ($form_id) {
    case 'node_work_form':
      $form['actions']['submit']['#submit'][] = 'work_redirect';
      break;
  }
}

function work_redirect($form, FormStateInterface $form_state) {
  // Set redirect to some path.
  $form_state-&gt;setRedirect(''); // What should I provide here as an argument/arguments
}
For Views, the route pattern is view.(view_id).(display_id).

For instance, if I have a view called Articles, and a display that I named "All", it would be:

$form_state-&gt;setRedirect('view.articles.all');


If you don't rename your display ids (I usually do), it is probably page_1 or something of that nature.

Beyond that it's similar to how it was before. Here is a redirect with query string args attached:

$form_state-&gt;setRedirect('view.articles.all', ['keywords' =&gt; $form_state-&gt;getValue('keywords')]);