summaryrefslogtreecommitdiffstatshomepage
path: root/core/lib/Drupal/Core/Pager/PagerParametersInterface.php
blob: a88286e512783b9f9939086ab53dbf349de4ea93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php

namespace Drupal\Core\Pager;

/**
 * Interface describing pager information contained within the request.
 *
 * @see \Drupal\Core\Pager\PagerManagerInterface
 */
interface PagerParametersInterface {

  /**
   * Gets all request URL query parameters that are unrelated to paging.
   *
   * @return array
   *   A URL query parameter array that consists of all components of the
   *   current page request except for those pertaining to paging.
   */
  public function getQueryParameters();

  /**
   * Returns the current page being requested for display within a pager.
   *
   * @param int $pager_id
   *   (optional) An integer to distinguish between multiple pagers on one page.
   *
   * @return int
   *   The number of the current requested page, within the pager represented by
   *   $element. This is determined from the URL query parameter
   *   \Drupal::request()->query->get('page'), or 0 by default. Note that this
   *   number may differ from the actual page being displayed. For example, if a
   *   search for "example text" brings up three pages of results, but a user
   *   visits search/node/example+text?page=10, this function will return 10,
   *   even though the default pager implementation adjusts for this and still
   *   displays the third page of search results at that URL.
   */
  public function findPage($pager_id = 0);

  /**
   * Gets the request query parameter.
   *
   * @return int[]
   *   Array of pagers. Keys are integers which are the element ID. Values are
   *   the zero-based current page from the request. The first page is 0, the
   *   second page is 1, etc.
   */
  public function getPagerQuery();

  /**
   * Gets the 'page' query parameter for the current request.
   *
   * @return string
   *   The 'page' query parameter for the current request. This is a
   *   comma-delimited string of pager element values. Defaults to empty string
   *   if the query does not have a 'page' parameter.
   */
  public function getPagerParameter();

}