class ArrayExtension extends AbstractExtension (View source)

Bolt specific Twig functions and filters that provide array manipulation.

Methods

array
getFilters()

{@inheritdoc}

shuffle($array)

Randomly shuffle the contents of a passed array.

length(Environment $env, $thing)

Returns the length of a variable.

static array
order(array $array, string $on = '-datepublish', string|null $onSecondary = null)

Sorts / orders items of an array.

Details

array getFilters()

{@inheritdoc}

Return Value

array

shuffle($array)

Randomly shuffle the contents of a passed array.

Parameters

$array

length(Environment $env, $thing)

Returns the length of a variable.

Overrides the default Twig |length filter for accurate results with paginated content

Parameters

Environment $env
$thing

static array order(array $array, string $on = '-datepublish', string|null $onSecondary = null)

Sorts / orders items of an array.

Parameters

array $array
string $on
string|null $onSecondary

Return Value

array