You are here

public function Common::redirectRoute in Filebrowser 8.2

Same name and namespace in other branches
  1. 3.x src/Services/Common.php \Drupal\filebrowser\Services\Common::redirectRoute()

Helper function to create the route to redirect a form to after submission

Parameters

$query_fid:

$nid:

Return value

mixed

File

src/Services/Common.php, line 284

Class

Common
Class Common @package Drupal\filebrowser\Services

Namespace

Drupal\filebrowser\Services

Code

public function redirectRoute($query_fid, $nid) {
  $route['name'] = 'entity.node.canonical';
  $route['node'] = [
    'node' => $nid,
  ];
  $route['query'] = !empty($query_fid) ? [
    'query' => [
      'fid' => $query_fid,
    ],
  ] : [];
  return $route;
}