function PathChangedHelper::redirect

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Routing/PathChangedHelper.php \Drupal\Core\Routing\PathChangedHelper::redirect()

Returns a redirect to the new path.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect response.

File

core/lib/Drupal/Core/Routing/PathChangedHelper.php, line 106

Class

PathChangedHelper
Provides helper functions for handling path changes.

Namespace

Drupal\Core\Routing

Code

public function redirect() : RedirectResponse {
    return new RedirectResponse($this->newUrl
        ->toString(), 301);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.