You are here

interface PagererInterface in Pagerer 8

Provides an interface for the Pagerer pager management class.

Hierarchy

Expanded class hierarchy of PagererInterface

All classes that implement PagererInterface

File

src/PagererInterface.php, line 8

Namespace

Drupal\pagerer
View source
interface PagererInterface {

  /**
   * Gets the route name for this pager.
   *
   * @return string
   *   The route name.
   */
  public function getRouteName();

  /**
   * Sets the route name for this pager.
   *
   * @param string $route_name
   *   The route name.
   *
   * @return $this
   */
  public function setRouteName($route_name);

  /**
   * Gets the route parameters for this pager.
   *
   * @return string[]
   *   The route parameters.
   */
  public function getRouteParameters();

  /**
   * Sets the route parameters for this pager.
   *
   * @param string[] $route_parameters
   *   The route parameters.
   *
   * @return $this
   */
  public function setRouteParameters(array $route_parameters);

  /**
   * Gets the pager element.
   *
   * @return int
   *   The pager element.
   */
  public function getElement();

  /**
   * Initializes the pager.
   *
   * @param int $total
   *   The total number of items to be paged.
   * @param int $limit
   *   The number of items the calling code will display per page.
   *
   * @return \Drupal\pagerer\Pagerer
   *   The Pagerer pager object.
   */
  public function init($total, $limit);

  /**
   * Gets the current page.
   *
   * @return int
   *   The page to which the pager is currently positioned to.
   */
  public function getCurrentPage();

  /**
   * Gets total pages in the pager.
   *
   * @return int
   *   The total number of pages managed by the pager.
   */
  public function getTotalPages();

  /**
   * Gets last page in the pager (zero-index).
   *
   * @return int
   *   The index of the last page in the pager.
   */
  public function getLastPage();

  /**
   * Gets total items in the pager.
   *
   * @return int
   *   The total number of items (records) managed by the pager.
   */
  public function getTotalItems();

  /**
   * Gets the items per page.
   *
   * @return int
   *   The number of items (records) in each page.
   */
  public function getLimit();

  /**
   * Gets the adaptive keys of this pager.
   *
   * Used by the Adaptive pager style.
   *
   * @return string
   *   The adaptive keys string, in the format 'L.R.X', where L is the
   *   adaptive lock to left page, R is the adaptive lock to right page,
   *   and X is the adaptive center lock for calculation of neighborhood.
   */
  public function getAdaptiveKeys();

  /**
   * Gets the query parameters array of a pager link.
   *
   * @param array $parameters
   *   An associative array of query string parameters to append to the pager
   *   links.
   * @param int $page
   *   The target page.
   * @param string $adaptive_keys
   *   The adaptive keys string, in the format 'L.R.X', where L is the
   *   adaptive lock to left page, R is the adaptive lock to right page,
   *   and X is the adaptive center lock for calculation of neighborhood.
   *
   * @return array
   *   The updated array of query parameters.
   */
  public function getQueryParameters(array $parameters, $page, $adaptive_keys = NULL);

  /**
   * Gets a pager link.
   *
   * @param array $parameters
   *   An associative array of query string parameters to append to the pager
   *   links.
   * @param int $page
   *   The target page.
   * @param string $adaptive_keys
   *   The adaptive keys string, in the format 'L.R.X', where L is the
   *   adaptive lock to left page, R is the adaptive lock to right page,
   *   and X is the adaptive center lock for calculation of neighborhood.
   * @param bool $set_query
   *   Whether the link should contain the query parameters.
   *
   * @return \Drupal\Core\Url
   *   The Url object for the link.
   */
  public function getHref(array $parameters, $page, $adaptive_keys = NULL, $set_query = TRUE);

}

Members

Namesort descending Modifiers Type Description Overrides
PagererInterface::getAdaptiveKeys public function Gets the adaptive keys of this pager. 1
PagererInterface::getCurrentPage public function Gets the current page. 1
PagererInterface::getElement public function Gets the pager element. 1
PagererInterface::getHref public function Gets a pager link. 1
PagererInterface::getLastPage public function Gets last page in the pager (zero-index). 1
PagererInterface::getLimit public function Gets the items per page. 1
PagererInterface::getQueryParameters public function Gets the query parameters array of a pager link. 1
PagererInterface::getRouteName public function Gets the route name for this pager. 1
PagererInterface::getRouteParameters public function Gets the route parameters for this pager. 1
PagererInterface::getTotalItems public function Gets total items in the pager. 1
PagererInterface::getTotalPages public function Gets total pages in the pager. 1
PagererInterface::init public function Initializes the pager. 1
PagererInterface::setRouteName public function Sets the route name for this pager. 1
PagererInterface::setRouteParameters public function Sets the route parameters for this pager. 1