Documentation

Themes extends Iterator
in package

Class Themes

Table of Contents

Properties

$config  : Config
$grav  : Grav
$inited  : bool
$items  : array<string|int, mixed>

Methods

__call()  : mixed
Convert function calls for the existing keys into their values.
__clone()  : mixed
Clone the iterator.
__construct()  : mixed
Themes constructor.
__toString()  : string
Convents iterator to a comma separated list.
all()  : array<string|int, mixed>
Return list of all theme data with their blueprints.
append()  : $this
Append new elements to the list.
configure()  : void
Configure and prepare streams for current template.
current()  : string
Return name of the current theme.
filter()  : $this
Filter elements from the list
first()  : mixed
Get the first item
get()  : Data|null
Get theme configuration or throw exception if it cannot be found.
indexOf()  : string|int|false
init()  : void
initTheme()  : void
last()  : mixed
Get the last item
load()  : Theme
Load current theme.
nth()  : mixed|bool
Return nth item.
prev()  : mixed
Return previous item.
random()  : $this
Pick one or more random entries.
remove()  : void
Remove item from the list.
reverse()  : $this
Reverse the Iterator
shuffle()  : $this
Shuffle items.
slice()  : $this
Slice the list.
sort()  : $this|array<string|int, mixed>
Sorts elements from the list and returns a copy of the list in the proper order
autoloadTheme()  : mixed|false
Autoload theme classes for inheritance
loadConfiguration()  : void
Load theme configuration.
loadLanguages()  : void
Load theme languages.

Properties

$inited

protected bool $inited = false

$items

protected array<string|int, mixed> $items = []

Methods

__call()

Convert function calls for the existing keys into their values.

public __call(string $key, mixed $args) : mixed
Parameters
$key : string
$args : mixed
Attributes
#[ReturnTypeWillChange]

__clone()

Clone the iterator.

public __clone() : mixed
Attributes
#[ReturnTypeWillChange]

__construct()

Themes constructor.

public __construct(Grav $grav) : mixed
Parameters
$grav : Grav

__toString()

Convents iterator to a comma separated list.

public __toString() : string
Attributes
#[ReturnTypeWillChange]
Return values
string

all()

Return list of all theme data with their blueprints.

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

append()

Append new elements to the list.

public append(array<string|int, mixed>|Iterator $items) : $this
Parameters
$items : array<string|int, mixed>|Iterator

Items to be appended. Existing keys will be overridden with the new values.

Return values
$this

configure()

Configure and prepare streams for current template.

public configure() : void
Tags
throws
InvalidArgumentException

current()

Return name of the current theme.

public current() : string
Return values
string

filter()

Filter elements from the list

public filter([callable|null $callback = null ]) : $this
Parameters
$callback : callable|null = null

A function the receives ($value, $key) and must return a boolean to indicate filter status

Return values
$this

first()

Get the first item

public first() : mixed

get()

Get theme configuration or throw exception if it cannot be found.

public get(string $name) : Data|null
Parameters
$name : string
Tags
throws
RuntimeException
Return values
Data|null

indexOf()

public indexOf(mixed $needle) : string|int|false
Parameters
$needle : mixed

Searched value.

Return values
string|int|false

Key if found, otherwise false.

initTheme()

public initTheme() : void

last()

Get the last item

public last() : mixed

nth()

Return nth item.

public nth(int $key) : mixed|bool
Parameters
$key : int
Return values
mixed|bool

prev()

Return previous item.

public prev() : mixed

random()

Pick one or more random entries.

public random([int $num = 1 ]) : $this
Parameters
$num : int = 1

Specifies how many entries should be picked.

Return values
$this

remove()

Remove item from the list.

public remove(string $key) : void
Parameters
$key : string

reverse()

Reverse the Iterator

public reverse() : $this
Return values
$this

shuffle()

Shuffle items.

public shuffle() : $this
Return values
$this

slice()

Slice the list.

public slice(int $offset[, int|null $length = null ]) : $this
Parameters
$offset : int
$length : int|null = null
Return values
$this

sort()

Sorts elements from the list and returns a copy of the list in the proper order

public sort([callable|null $callback = null ][, bool $desc = false ]) : $this|array<string|int, mixed>
Parameters
$callback : callable|null = null
$desc : bool = false
Return values
$this|array<string|int, mixed>

autoloadTheme()

Autoload theme classes for inheritance

protected autoloadTheme(string $class) : mixed|false
Parameters
$class : string

Class name

Return values
mixed|false

FALSE if unable to load $class; Class name if $class is successfully loaded

loadConfiguration()

Load theme configuration.

protected loadConfiguration(string $name, Config $config) : void
Parameters
$name : string

Theme name

$config : Config

Configuration class

loadLanguages()

Load theme languages.

protected loadLanguages(Config $config) : void

Reads ALL language files from theme stream and merges them.

Parameters
$config : Config

Configuration class


        
On this page

Search results