You are here

protected function PagererParameters::parseLegacy in Pagerer 8.2

Parses a legacy pager querystring.

Parameters

string $hash: The hash of the current request.

string $page: The value of the 'page' querystring parameter.

string $page_ak: The value of the 'page_ak' querystring parameter.

1 call to PagererParameters::parseLegacy()
PagererParameters::getPagererItem in src/PagererParameters.php
Returns a Pagerer 'pager item'.

File

src/PagererParameters.php, line 187

Class

PagererParameters
Provides extended pager information contained within the current request.

Namespace

Drupal\pagerer

Code

protected function parseLegacy(string $hash, string $page, string $page_ak) {

  // Current pages.
  if (!empty($page)) {
    $tmp = explode(',', $page);
    foreach ($tmp as $pager_id => $page) {
      $this->pagererItems[$hash]['page'][$pager_id] = (int) $page;
    }
  }

  // Current adaptive keys.
  if (!empty($page_ak)) {
    $tmp = explode(',', $page_ak);
    foreach ($tmp as $pager_id => $ak) {
      $tmp_0 = explode('.', $ak);
      $this->pagererItems[$hash]['ak'][$pager_id][0] = !empty($tmp_0[0]) ? $tmp_0[0] : NULL;
      $this->pagererItems[$hash]['ak'][$pager_id][1] = isset($tmp_0[1]) ? (int) $tmp_0[1] : NULL;
      if (isset($tmp_0[2])) {
        $this->pagererItems[$hash]['ak'][$pager_id][2] = (int) $tmp_0[2];
      }
    }
  }
}