Cecil

Collection extends AbstractExtension

Collection Twig extension.

Provides filters for filtering and sorting page collections in Twig templates.

Table of Contents

Properties

$builder  : Builder

Methods

__construct()  : mixed
filterBy()  : CollectionInterface
Filters a pages collection by variable's name/value.
filterBySection()  : CollectionInterface
Filters by Section.
getFilters()  : array<string|int, mixed>
sortByDate()  : array<string|int, mixed>
Sorts by creation date (or 'updated' date): the most recent first.
sortByTitle()  : array<string|int, mixed>
Sorts a collection by title.
sortByWeight()  : array<string|int, mixed>
Sorts a collection by weight.

Properties

Methods

getFilters()

public getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>

sortByDate()

Sorts by creation date (or 'updated' date): the most recent first.

public sortByDate(Traversable $collection[, string $variable = 'date' ][, bool $descTitle = false ]) : array<string|int, mixed>
Parameters
$collection : Traversable
$variable : string = 'date'
$descTitle : bool = false
Return values
array<string|int, mixed>

sortByTitle()

Sorts a collection by title.

public sortByTitle(Traversable $collection) : array<string|int, mixed>
Parameters
$collection : Traversable
Return values
array<string|int, mixed>

sortByWeight()

Sorts a collection by weight.

public sortByWeight(Traversable|array<string|int, mixed> $collection) : array<string|int, mixed>
Parameters
$collection : Traversable|array<string|int, mixed>
Return values
array<string|int, mixed>
On this page

Search results