You are here

public function CleanPager::cleanPagerGetQ in Clean Pagination 8

1 call to CleanPager::cleanPagerGetQ()
CleanPager::handle in src/StackMiddleware/CleanPager.php
Handles a Request to convert it to a Response.

File

src/StackMiddleware/CleanPager.php, line 35

Class

CleanPager
Provides a HTTP middleware.

Namespace

Drupal\cleanpager\StackMiddleware

Code

public function cleanPagerGetQ($request) {
  $q = isset($_GET['q']) ? $_GET['q'] : '';
  $current_path = $request
    ->getPathInfo();
  $path = explode('/', $current_path);
  if ($path[1] == 'views' && $path[2] == 'ajax' && !empty($_POST['view_path'])) {
    $q = rtrim($_POST['view_path'], '/');
  }
  return $q ? $q : $current_path;
}