Skip to content

Kirby 3.5.7.1

Pages::factory()

Creates a pages collection from an array of props

Pages::factory(array $pages, Kirby\Cms\Model $model = null, bool $draft = false): Kirby\Cms\Pages

Parameters

Name Type Default
$pages * array
$model Kirby\Cms\Model null
$draft bool false

The $pages parameter is an array of Kirby\Cms\Page objects or an array of arrays, where each array contains the properties to create a Kirby\Cms\Page object. Pass the following data for each page:

Name Type Description
blueprint array Sets the Blueprint object
children array Sets the Children collection
content array Sets the Content object
dirname string Sets the dirname manually, which works
more reliable in connection with the inventory
than computing the dirname afterwards
drafts array Sets the Drafts collection
files array Sets the Files collection
isDraft bool Sets the draft flag
num int Sets the sorting number
parent Kirby\Cms\Page Sets the parent page object
root string Sets the absolute path to the page
slug * string Sets the required Page slug
template string Sets the intended template
translations array Create the translations collection from an array
url string Sets the Url

Return type

Kirby\Cms\Pages

Parent class

Kirby\Cms\Pages