You are here

function redirect_404_redirect_presave in Redirect 8

Implements hook_ENTITY_TYPE_presave() for redirect entities.

File

modules/redirect_404/redirect_404.module, line 98
Module file for redirect_404.

Code

function redirect_404_redirect_presave(Redirect $redirect) {
  $path = $redirect
    ->getSourcePathWithQuery();
  $langcode = $redirect
    ->get('language')->value;

  // Mark a potentially existing log entry for this path as resolved.
  \Drupal::service('redirect.not_found_storage')
    ->resolveLogRequest($path, $langcode);
}