public function Fix404IgnoreController::ignorePath in Redirect 8
Adds path into the ignored list.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The HttpRequest object representing the current request.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse
1 string reference to 'Fix404IgnoreController::ignorePath'
- redirect_404.routing.yml in modules/
redirect_404/ redirect_404.routing.yml - modules/redirect_404/redirect_404.routing.yml
File
- modules/
redirect_404/ src/ Controller/ Fix404IgnoreController.php, line 62
Class
- Fix404IgnoreController
- Controller to ignore a path from the 'Fix 404 pages' page.
Namespace
Drupal\redirect_404\ControllerCode
public function ignorePath(Request $request) {
$ignored_paths = $this
->config('redirect_404.settings')
->get('pages');
$path = $request->query
->get('path');
$langcode = $request->query
->get('langcode');
if (empty($ignored_paths) || !strpos($path, $ignored_paths)) {
$this->redirectStorage
->resolveLogRequest($path, $langcode);
$this
->messenger()
->addMessage($this
->t('Resolved the path %path in the database. Please check the ignored list and save the settings.', [
'%path' => $path,
]));
}
$options = [
'query' => [
'ignore' => $path,
'destination' => Url::fromRoute('redirect_404.fix_404')
->getInternalPath(),
],
];
return $this
->redirect('redirect.settings', [], $options);
}