AddonPage
A page whose view comes from an addon, resolving its views from the addon folder rather than the site.
Properties (18)
| $addonPage->id | string | readonly | |
| $addonPage->addonRoot | string | readonly | |
| $addonPage->mountUrl | string | readonly | |
| $addonPage->source | string | readonly | |
| $addonPage->router | Router | readonly | |
| $addonPage->view | ?string | readonly | |
| $addonPage->published | bool | readonly | Whether this page is live - true unless _index.json says false. |
| $addonPage->access | string | readonly | Who may open this page: '' for anyone, 'login' for any signed-in user, or role names joined by '|'. |
| $addonPage->hidden | bool | readonly | Whether this page is left out of navigation and child lists. |
| $addonPage->position | int | readonly | Where this page sits among its siblings when its parent's view sorts by `position` - set by dragging it in the admin tree. |
| $addonPage->uri | string | readonly | |
| $addonPage->path | string | readonly | |
| $addonPage->objectRoot | string | readonly | |
| $addonPage->uuid | string | readonly | |
| $addonPage->locked | bool | readonly | |
| $addonPage->created | ?int | readonly | |
| $addonPage->updated | ?int | readonly | |
| $addonPage->isRoot | bool | readonly |
- children The registry only indexes site pages, so an addon page's children are listed from the addon's own pages folder.
- emit Fires `@alias/event`, the same name `$app->addon($alias)->emit()` gives.
- fileSourcePath Where the addon ships this page's files and data, wherever the page itself is backed.
- session All of an addon's views share one session scope, `@alias`, which no site view's scope can be.
- url Returns the site-relative URL by stripping the pages/ root from the filesystem path.
- view A bare view in the addon's own pages/ is the addon's; no view at all is its `home`.
From Page 58
- assertViewable Throws what the current visitor gets for a page they may not open: a 404 for an unpublished one (it doesn't admit to existing), a login redirect for a gated page when signed out, a 403 when signed in without the role.
- autosave Persists a draft of the view's fields outside the normal save path - no _index.json, no registry, no git.
- boundClass The class App::loadType() looks for when views/{name}/{name}.php declares a bound subclass, e.g. "article" -> ArticlePage.
- cache This page's part of the pages cache.
- child Returns a named child page without checking whether it exists.
- childDepth The depth new children are placed at: one below this page, or deeper when its view's `children.path` puts them in folders.
- childFields The fields a new child is made from: its name, unless this view names pages by uuid, and its view when there is a choice.
- childViews The views an editor may give a new child: the view's `children.views`.
- closest Returns the nearest page matching $query (the find() DSL) walking up from this page, this page included, or null if none does.
- contains True if $other is this page or a descendant of it.
- controller Includes a view's controller file and calls it if it returns a callable; returns the resulting data array.
- data The page's content.
- delete Deletes this page and its persisted subtree - PageCollection::delete() for one page, which has the details.
- depth Returns the depth in the page tree. 0 for root pages.
- discardAutosave Clears any pending draft.
- fields Returns this page's template fields as resolved FieldValue instances.
- file Resolves a file from this page's own folder.
- files This page's files, narrowed by the query DSL over filename, name, extension, type, mime, size, modified and their metadata fields: `files('type=image,sort=filename,limit=4')`.
- find Queries the registry for pages within this page's subtree.
- fragment Whether this page renders as a bare fragment - its own _index.json wins over the view's default.
- has Whether a child page folder already exists on disk.
- hasAutosave Whether an unsaved draft exists for this page.
- hasChildren True if this page has any children.
- image Resolves an image from this page's own folder.
- isActive True if this page is the current request page.
- isOpen True if this page is active or contains the active page.
- isPublic Whether anyone at all may open this page - it and every ancestor published and open to all - whoever is asking.
- isSourced Whether this page's parent is a PageSource: its content comes from that source, and it is never in the registry.
- isViewable Whether the current visitor may open this page.
- move Moves (or renames) this page and its whole subtree to $newPath, e.g. "blog/2026/post".
- moveFields The fields a move is made from: the page's name and its parent, any page whose view takes this one's (or where it is now).
- new Creates a new child page: mints its uuid and writes a complete, minimal _index.json in one shot, then applies $data via the normal save() path - structural keys (view/hidden/ published/locked) to _index.json, everything else to _data.json (only written if there's content).
- next Returns the next sibling in parent's child order, or null if this is the last.
- objectType Always `page`.
- pageCount How many pages children($query) fill at the page limit; 1 when the limit is 0.
- pageLimit The page size: $limit, else the view's `pagination.limit` over the app's. 0 means no limit.
- paginate The current `?page=N` slice of children($query); every child when the limit is 0.
- parent Returns the parent page, or null if this page has no parent (including root pages).
- parents Returns all ancestor pages from root to immediate parent, lazily computed and cached.
- prev Returns the previous sibling in parent's child order, or null if this is the first.
- publicPath Returns this page's public-mirror directory, e.g. "" -> public/, "blog/post" -> public/blog/post.
- registryFields Extra registry columns this object type contributes (e.g. view for pages, role for users).
- registryKeyFor Builds a page registry key from a raw page uuid, for callers without a live Page instance.
- registryPath The path stored in the registry for this object.
- remainder Returns the request path after stripping this page's own URL prefix, trimmed of slashes.
- render Renders the page view, merging in global and view-specific controller data.
- reorderable Whether this page's children are put in order by hand: its view's `children.sort` is `position`.
- root Returns the root page.
- route Dispatches the request sub-path against this page's view router.
- save Persists page data, routing structural fields to _index.json and the view's fields to _data.json.
- section Returns the top-level section page.
- segment Returns the nth segment (1-indexed) of the request sub-path, or null.
- settingFields The structural settings an editor sets - published, access, hidden, locked - as FieldValues, so the admin edits them with the same field UI as everything else.
- siblings Returns sibling pages - children of the parent, excluding this page.
- target Resolves remainder() as a Page, the common case behind most remainder() call sites.
- viewConfig Returns app-level config under $key merged with this view's override of the same key.
- viewFields The view a page without one is given: the ones its parent's view takes, or any when it names none.
- withData This page reading $data as its content, in place of its files and any draft.
From Record 12
- assertUnlocked A locked record is protected: it can't be changed or deleted until `locked` is turned off.
- create The one way a record comes into being: under the lock for $key (default: the path) $guard refuses a conflict, then $make builds the record at $path and save() applies $data.
- exists Whether the record is on disk.
- generateUuid The current system uuid format - the single source of truth for tooling that needs to mint or recognize one.
- index The `_index.json` file: uuid, timestamps and the type's structural keys.
- isSiteObject Whether it lives in the site rather than in `phlat/` or an addon.
- keyFor Builds a registry uuid key from a type and identity value, e.g. keyFor('page', $uuid) -> "page:{uuid}".
- name The folder name: the last segment of a page's URL, or a username.
- path The record's folder, with a trailing slash.
- publishedData The canonical _data.json contents, bypassing any draft/preview override (e.g.
- registryKey The registry's uuid key for this object, e.g. "page:{uuid}".
- upload Validates and stores an uploaded file (a raw $_FILES-shape array) into this record's own folder.
Methods
$addonPage->children(string $query = '', bool $includeHidden = false): PageCollection
The registry only indexes site pages, so an addon page's children are listed from the addon's own pages folder.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns PageCollection
phlat/src/AddonPage.php:76
$addonPage->emit(string $event, mixed ...$args): void
Fires `@alias/event`, the same name `$app->addon($alias)->emit()` gives.
Parameters (2)
| $event | string | |
| ...$args | mixed |
phlat/src/AddonPage.php:43
$addonPage->fileSourcePath(): string
Where the addon ships this page's files and data, wherever the page itself is backed.
Returns string
phlat/src/AddonPage.php:70
$addonPage->url(string $path = '', array $query = []): string
Returns the site-relative URL by stripping the pages/ root from the filesystem path.
Parameters (2)
| $path | string = '' | |
| $query | array = [] |
Returns string
phlat/src/AddonPage.php:48
$addonPage->view(): PageView
A bare view in the addon's own pages/ is the addon's; no view at all is its `home`.
Returns PageView
phlat/src/AddonPage.php:108
From Page
$addonPage->assertViewable(): void
Throws what the current visitor gets for a page they may not open: a 404 for an unpublished one (it doesn't admit to existing), a login redirect for a gated page when signed out, a 403 when signed in without the role.
phlat/src/Page.php:567
$addonPage->autosave(array $data): void
Persists a draft of the view's fields outside the normal save path - no _index.json, no registry, no git.
Parameters (1)
| $data | array |
phlat/src/Page.php:390
boundClass
staticAddonPage::boundClass(string $name): string
The class App::loadType() looks for when views/{name}/{name}.php declares a bound subclass, e.g. "article" -> ArticlePage.
Parameters (1)
| $name | string |
Returns string
phlat/src/Page.php:87
$addonPage->cache(): Cache
This page's part of the pages cache.
Returns Cache
phlat/src/Page.php:528
$addonPage->childDepth(): int
The depth new children are placed at: one below this page, or deeper when its view's `children.path` puts them in folders.
Returns int
phlat/src/Page.php:792
$addonPage->childFields(): FieldValueSet
The fields a new child is made from: its name, unless this view names pages by uuid, and its view when there is a choice.
Returns FieldValueSet
phlat/src/Page.php:335
$addonPage->childViews(): array
The views an editor may give a new child: the view's `children.views`.
Returns array
phlat/src/Page.php:804
$addonPage->controller(string $viewName, array $context = []): array
Includes a view's controller file and calls it if it returns a callable; returns the resulting data array.
Parameters (2)
| $viewName | string | |
| $context | array = [] |
Returns array
phlat/src/Page.php:470
$addonPage->data(): DataFile
The page's content.
Returns DataFile
phlat/src/Page.php:412
$addonPage->delete(): void
Deletes this page and its persisted subtree - PageCollection::delete() for one page, which has the details.
phlat/src/Page.php:225
$addonPage->depth(): int
Returns the depth in the page tree. 0 for root pages.
Returns int
phlat/src/Page.php:786
$addonPage->discardAutosave(): void
Clears any pending draft.
phlat/src/Page.php:402
$addonPage->fields(): FieldValueSet
Returns this page's template fields as resolved FieldValue instances.
Returns FieldValueSet
phlat/src/Page.php:287
$addonPage->files(string $query = ''): array
This page's files, narrowed by the query DSL over filename, name, extension, type, mime, size, modified and their metadata fields: `files('type=image,sort=filename,limit=4')`.
Parameters (1)
| $query | string = '' |
Returns array
phlat/src/Page.php:1094
$addonPage->find(string $query = ''): PageCollection
Queries the registry for pages within this page's subtree.
Parameters (1)
| $query | string = '' |
Returns PageCollection
phlat/src/Page.php:1050
$addonPage->fragment(): bool
Whether this page renders as a bare fragment - its own _index.json wins over the view's default.
Returns bool
phlat/src/Page.php:74
$addonPage->has(string $slug): bool
Whether a child page folder already exists on disk.
Parameters (1)
| $slug | string |
Returns bool
phlat/src/Page.php:896
$addonPage->hasAutosave(): bool
Whether an unsaved draft exists for this page.
Returns bool
phlat/src/Page.php:384
$addonPage->hasChildren(bool $includeHidden = false): bool
True if this page has any children.
Parameters (1)
| $includeHidden | bool = false |
Returns bool
phlat/src/Page.php:865
$addonPage->isActive(): bool
True if this page is the current request page.
Returns bool
phlat/src/Page.php:871
$addonPage->isOpen(): bool
True if this page is active or contains the active page.
Returns bool
phlat/src/Page.php:877
$addonPage->isPublic(): bool
Whether anyone at all may open this page - it and every ancestor published and open to all - whoever is asking.
Returns bool
phlat/src/Page.php:546
$addonPage->isSourced(): bool
Whether this page's parent is a PageSource: its content comes from that source, and it is never in the registry.
Returns bool
phlat/src/Page.php:135
$addonPage->isViewable(): bool
Whether the current visitor may open this page.
Returns bool
phlat/src/Page.php:556
$addonPage->move(string $newPath): Page
Moves (or renames) this page and its whole subtree to $newPath, e.g. "blog/2026/post".
Parameters (1)
| $newPath | string |
Returns Page
phlat/src/Page.php:237
$addonPage->moveFields(): FieldValueSet
The fields a move is made from: the page's name and its parent, any page whose view takes this one's (or where it is now).
Returns FieldValueSet
phlat/src/Page.php:357
$addonPage->new(string $name, array $data = []): Page
Creates a new child page: mints its uuid and writes a complete, minimal _index.json in one shot, then applies $data via the normal save() path - structural keys (view/hidden/ published/locked) to _index.json, everything else to _data.json (only written if there's content).
Parameters (2)
| $name | string | |
| $data | array = [] |
Returns Page
phlat/src/Page.php:913
$addonPage->next(string $query = '', bool $includeHidden = false): ?Page
Returns the next sibling in parent's child order, or null if this is the last.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns ?Page
phlat/src/Page.php:820
$addonPage->pageCount(string $query = '', ?int $limit = null): int
How many pages children($query) fill at the page limit; 1 when the limit is 0.
Parameters (2)
| $query | string = '' | |
| $limit | ?int = null |
Returns int
phlat/src/Page.php:1031
$addonPage->pageLimit(?int $limit = null): int
The page size: $limit, else the view's `pagination.limit` over the app's. 0 means no limit.
Parameters (1)
| $limit | ?int = null |
Returns int
phlat/src/Page.php:1013
$addonPage->paginate(string $query = '', ?int $limit = null): PageCollection
The current `?page=N` slice of children($query); every child when the limit is 0.
Parameters (2)
| $query | string = '' | |
| $limit | ?int = null |
Returns PageCollection
phlat/src/Page.php:1019
$addonPage->parents(string $query = ''): PageCollection
Returns all ancestor pages from root to immediate parent, lazily computed and cached.
Parameters (1)
| $query | string = '' |
Returns PageCollection
phlat/src/Page.php:725
$addonPage->prev(string $query = '', bool $includeHidden = false): ?Page
Returns the previous sibling in parent's child order, or null if this is the first.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns ?Page
phlat/src/Page.php:826
$addonPage->publicPath(): string
Returns this page's public-mirror directory, e.g. "" -> public/, "blog/post" -> public/blog/post.
Returns string
phlat/src/Page.php:1071
$addonPage->registryFields(): array
Extra registry columns this object type contributes (e.g. view for pages, role for users).
Returns array
phlat/src/Page.php:117
registryKeyFor
staticAddonPage::registryKeyFor(string $uuid): string
Builds a page registry key from a raw page uuid, for callers without a live Page instance.
Parameters (1)
| $uuid | string |
Returns string
phlat/src/Page.php:107
$addonPage->registryPath(): string
The path stored in the registry for this object.
Returns string
phlat/src/Page.php:112
$addonPage->remainder(): string
Returns the request path after stripping this page's own URL prefix, trimmed of slashes.
Returns string
phlat/src/Page.php:677
$addonPage->render(array $data = [], ?string $block = null): string
Renders the page view, merging in global and view-specific controller data.
Parameters (2)
| $data | array = [] | |
| $block | ?string = null |
Returns string
phlat/src/Page.php:485
$addonPage->reorderable(): bool
Whether this page's children are put in order by hand: its view's `children.sort` is `position`.
Returns bool
phlat/src/Page.php:798
$addonPage->segment(int $n): ?string
Returns the nth segment (1-indexed) of the request sub-path, or null.
Parameters (1)
| $n | int |
Returns ?string
phlat/src/Page.php:694
$addonPage->settingFields(): FieldValueSet
The structural settings an editor sets - published, access, hidden, locked - as FieldValues, so the admin edits them with the same field UI as everything else.
Returns FieldValueSet
phlat/src/Page.php:302
$addonPage->siblings(string $query = '', bool $includeHidden = false): PageCollection
Returns sibling pages - children of the parent, excluding this page.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns PageCollection
phlat/src/Page.php:810
$addonPage->viewConfig(string $key): array
Returns app-level config under $key merged with this view's override of the same key.
Parameters (1)
| $key | string |
Returns array
phlat/src/Page.php:376
$addonPage->viewFields(): FieldValueSet
The view a page without one is given: the ones its parent's view takes, or any when it names none.
Returns FieldValueSet
phlat/src/Page.php:350
$addonPage->withData(array $data): static
This page reading $data as its content, in place of its files and any draft.
Parameters (1)
| $data | array |
Returns static
phlat/src/Page.php:428
From Record
$addonPage->assertUnlocked(): void
A locked record is protected: it can't be changed or deleted until `locked` is turned off.
phlat/src/Data/Record.php:301
create
staticAddonPage::create(App $app, string $path, array $data, callable $make, callable $guard, string $uuid = '', ?string $key = null): T
The one way a record comes into being: under the lock for $key (default: the path) $guard refuses a conflict, then $make builds the record at $path and save() applies $data.
Parameters (7)
| $app | App | |
| $path | string | |
| $data | array | |
| $make | callable | |
| $guard | callable | |
| $uuid | string = '' | |
| $key | ?string = null |
Returns T
phlat/src/Data/Record.php:93
$addonPage->exists(): bool
Whether the record is on disk.
Returns bool
phlat/src/Data/Record.php:214
generateUuid
staticAddonPage::generateUuid(App $app): string
The current system uuid format - the single source of truth for tooling that needs to mint or recognize one.
Parameters (1)
| $app | App |
Returns string
phlat/src/Data/Record.php:79
$addonPage->index(): DataFile
The `_index.json` file: uuid, timestamps and the type's structural keys.
Returns DataFile
phlat/src/Data/Record.php:170
$addonPage->isSiteObject(): bool
Whether it lives in the site rather than in `phlat/` or an addon.
Returns bool
phlat/src/Data/Record.php:164
keyFor
staticAddonPage::keyFor(string $type, string $value): string
Builds a registry uuid key from a type and identity value, e.g. keyFor('page', $uuid) -> "page:{uuid}".
Parameters (2)
| $type | string | |
| $value | string |
Returns string
phlat/src/Data/Record.php:152
$addonPage->name(): string
The folder name: the last segment of a page's URL, or a username.
Returns string
phlat/src/Data/Record.php:242
$addonPage->path(): string
The record's folder, with a trailing slash.
Returns string
phlat/src/Data/Record.php:220
$addonPage->publishedData(): DataFile
The canonical _data.json contents, bypassing any draft/preview override (e.g.
Returns DataFile
phlat/src/Data/Record.php:187
$addonPage->registryKey(): string
The registry's uuid key for this object, e.g. "page:{uuid}".
Returns string
phlat/src/Data/Record.php:158