getPreviousPageURI example


    public function setLink(PagerInterface $pager)
    {
        $links = '';

        if ($previous = $pager->getPreviousPageURI()) {
            $links .= '<' . $pager->getPageURI($pager->getFirstPage()) . '>; rel="first",';
            $links .= '<' . $previous . '>; rel="prev"';
        }

        if (($next = $pager->getNextPageURI()) && $previous) {
            $links .= ',';
        }

        if ($next) {
            $links .= '<' . $next . '>; rel="next",';
            $links .= '<' . $pager->getPageURI($pager->getLastPage()) . '>; rel="last"';
        }

    public function getDetails(string $group = 'default'): array
    {
        if (array_key_exists($group$this->groups)) {
            throw PagerException::forInvalidPaginationGroup($group);
        }

        $newGroup = $this->groups[$group];

        $newGroup['next']     = $this->getNextPageURI($group);
        $newGroup['previous'] = $this->getPreviousPageURI($group);
        $newGroup['segment']  = $this->segment[$group] ?? 0;

        return $newGroup;
    }

    /** * Sets only allowed queries on pagination links. */
    public function only(array $queries): self
    {
        $this->only = $queries;

        
Home | Imprint | This part of the site doesn't use cookies.