class Pagelist (View source)

A Pagelist object represents a set of Page objects (matching certain criterias).

Methods

__construct(array $collection, object $Context)

Initialize the Pagelist.

array
config(array $options = array())

Set or change the configuration of the pagelist and return the current configuration as array.

array
getDefaults()

Return the default options array.

array
getTags()

Return all tags from all pages in $relevant as array.

array
getPages(boolean $ignoreLimit = false)

The final set of Page objects - filtered.

number
getPaginationCount()

Calculate the number of pages of the pagination.

Details

__construct(array $collection, object $Context)

Initialize the Pagelist.

Parameters

array $collection
object $Context

array config(array $options = array())

Set or change the configuration of the pagelist and return the current configuration as array.

To just get the config, call the method without passing $options.

Options:

  • context: an optionally fixed URL for the context of a pagelist of type breadcrumbs or children. In case this parameter is false, within a loop the context always changes dynamically to the current page.
  • excludeCurrent: default false
  • excludeHidden: default true
  • filter: filter pages by tags
  • limit: limit the object's array of relevant pages
  • match: filter pages by matching one or more key/regex combinations passed as JSON string
  • offset: offset the within the array of all relevant pages
  • page: false (the current page in the pagination - to be used with the limit parameter)
  • search: filter pages by search string
  • sort: sorting options string, like "date desc, title asc"
  • template: include only pages matching that template
  • type: sets the type of pagelist (default is false) - valid types are false (all), "children", "related", "siblings" and "breadcrumbs"

Parameters

array $options

Return Value

array Updated $options

array getDefaults()

Return the default options array.

Return Value

array Default options

array getTags()

Return all tags from all pages in $relevant as array.

Return Value

array A sorted array with the relevant tags.

array getPages(boolean $ignoreLimit = false)

The final set of Page objects - filtered.

Note that $offset & $limit only reduce the output and not the array of relevant pages! Using the getTags() method will still output all tags, even if pages with such tags are not returned due to the limit. Sorting a pagelist will also sort all pages and therefore the set of returned pages might always be different.

Parameters

boolean $ignoreLimit

Return Value

array The filtered and sorted array of Page objects

number getPaginationCount()

Calculate the number of pages of the pagination.

Return Value

number The number of pages of the current pagelist.