Page
in package
implements
PageInterface
uses
PageFormTrait, MediaTrait
Class Page
Table of Contents
Interfaces
- PageInterface
- Class implements page interface.
Properties
- $_loadMedia : bool
- $cache_control : string
- $content : string|null
- $content_meta : array<string|int, mixed>
- $date : int
- $dateformat : string
- $debugger : bool
- $etag : bool
- $expires : int
- $extension : string
- $external_url : string
- $folder : string
- $frontmatter : string
- $header : object|null
- $hide_home_route : bool
- $home_route : string
- $id : string
- $initialized : bool
- $language : string
- $last_modified : bool
- $markdown_extra : bool
- $max_count : int
- $media : MediaCollectionInterface|null
- $menu : string
- $metadata : array<string|int, mixed>|null
- $modified : int
- $modular_twig : bool
- $name : string|null
- $order_by : string
- $order_dir : string
- $order_manual : array<string|int, mixed>|string|null
- $parent : string
- $path : string
- $process : array<string|int, mixed>
- $publish_date : int
- $published : bool
- $raw_content : string
- $raw_route : string|null
- $redirect : string
- $routable : bool
- $route : string|null
- $routes : array<string|int, mixed>
- $slug : string
- $ssl : bool
- $summary : string|null
- $summary_size : int|null
- $taxonomy : array<string|int, mixed>
- $template : string
- $template_format : string
- $title : string
- $unpublish_date : int|null
- $url : string
- $url_extension : string
- $visible : bool
- $_action : string
- $_forms : array<string|int, mixed>|null
- $_original : PageInterface|null
Methods
- __clone() : mixed
- __construct() : mixed
- Page Object Constructor
- active() : bool
- Returns whether or not this page is the currently active page requested via the URL.
- activeChild() : bool
- Returns whether or not this URI's URL contains the URL of the active page.
- addContentMeta() : mixed
- Add an entry to the page's contentMeta array
- addForms() : $this
- Add forms to this page.
- adjacentSibling() : PageInterface|false
- Returns the adjacent sibling based on a direction.
- ancestor() : PageInterface
- Helper method to return an ancestor page.
- blueprintName() : string
- Get the blueprint name for this page. Use the blueprint form field if set
- blueprints() : Blueprint
- Get blueprints for the page.
- cacheControl() : string|null
- Gets and sets the cache-control property. If not set it will return the default value (null) https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control for more details on valid options
- cachePageContent() : void
- Fires the onPageContentProcessed event, and caches the page content using a unique ID for the page
- canonical() : string
- Returns the canonical URL for a page
- children() : PageCollectionInterface|Collection
- Returns children of this page.
- childType() : string
- Returns child page type.
- collection() : PageCollectionInterface|Collection
- Get a collection of pages in the current context.
- content() : string
- Gets and Sets the content based on content portion of the .md file
- contentMeta() : mixed
- Get the contentMeta array and initialize content first if it's not already
- copy() : $this
- Prepare a copy from the page. Copies also everything that's under the current page.
- currentPosition() : int|null
- Returns the item in the current position.
- date() : int
- Gets and sets the date for this Page object. This is typically passed in via the page headers
- dateformat() : string
- Gets and sets the date format for this Page object. This is typically passed in via the page headers using typical PHP date string structure - http://php.net/manual/en/function.date.php
- debugger() : bool
- Returns the state of the debugger override setting for this page
- eTag() : bool
- Gets and sets the option to show the etag header for the page.
- evaluate() : PageCollectionInterface|Collection
- exists() : bool
- Returns whether the page exists in the filesystem.
- expires() : int
- Gets and sets the expires field. If not set will return the default
- extension() : string
- Gets and sets the extension field.
- extra() : array<string|int, mixed>
- Get unknown header variables.
- file() : MarkdownFile|null
- Get file object to the page.
- filePath() : string|null
- Gets and sets the path to the .md file for this Page object.
- filePathClean() : string
- Gets the relative path to the .md file
- filter() : void
- Filter page header from illegal contents.
- find() : PageInterface
- Helper method to return a page.
- folder() : string|null
- Get/set the folder.
- folderExists() : bool
- Returns whether or not the current folder exists
- forms() : array<string|int, mixed>
- Alias of $this->getForms();
- frontmatter() : string
- Gets and Sets the page frontmatter
- getAction() : string|null
- Gets the action.
- getBlueprint() : Blueprint
- Returns the blueprint from the page.
- getCacheKey() : string
- getContentMeta() : mixed|null
- Return the whole contentMeta array as it currently stands
- getForms() : array<string|int, mixed>
- Return all the forms which are associated to this page.
- getMedia() : MediaCollectionInterface|Media
- Gets the associated media collection.
- getMediaFolder() : string|null
- Get filesystem path to the associated media.
- getMediaOrder() : array<string|int, mixed>
- Get display order for the associated media.
- getMediaUri() : string|null
- Get URI ot the associated media. Method will return null if path isn't URI.
- getOriginal() : PageInterface
- Gets the Page Unmodified (original) version of the page.
- getRawContent() : string
- Needed by the onPageContentProcessed event to get the raw page content
- header() : stdClass
- Gets and Sets the header based on the YAML configuration at the top of the .md file
- home() : bool
- Returns whether or not this page is the currently configured home page.
- httpHeaders() : array<string|int, mixed>
- httpResponseCode() : int
- id() : string
- Gets and sets the identifier for this Page object.
- inherited() : PageInterface
- Helper method to return an ancestor page to inherit from. The current page object is returned.
- inheritedField() : array<string|int, mixed>
- Helper method to return an ancestor field only to inherit from. The first occurrence of an ancestor field will be returned if at all.
- init() : $this
- Initializes the page instance variables based on a file
- initialize() : void
- isDir() : bool
- Returns whether or not this Page object is a directory or a page.
- isFirst() : bool
- Check to see if this item is the first in an array of sub-pages.
- isLast() : bool
- Check to see if this item is the last in an array of sub-pages.
- isModule() : bool
- Returns true if page is a module.
- isPage() : bool
- Returns whether or not this Page object has a .md file associated with it or if its just a directory.
- language() : mixed
- Get page language
- lastModified() : bool
- Gets and sets the option to show the last_modified header for the page.
- link() : string
- Gets the URL for a page - alias of url().
- maxCount() : int
- Gets and sets the maxCount field which describes how many sub-pages should be displayed if the sub_pages header property is set for this page object.
- media() : Media
- Gets and sets the associated media as found in the page folder.
- menu() : string
- Gets and sets the menu name for this Page. This is the text that can be used specifically for navigation.
- metadata() : array<string|int, mixed>
- Function to merge page metadata tags and build an array of Metadata objects that can then be rendered in the page.
- modified() : int
- Gets and sets the modified timestamp.
- modifyHeader() : mixed
- Modify a header value directly
- modular() : bool
- Gets and sets the modular var that helps identify this page is a modular child
- modularTwig() : bool
- Gets and sets the modular_twig var that helps identify this page as a modular child page that will need twig processing handled differently from a regular page.
- move() : $this
- Prepare move page to new location. Moves also everything that's under the current page.
- name() : string
- Gets and sets the name field. If no name field is set, it will return 'default.md'.
- nextSibling() : PageInterface
- Gets the next sibling based on current position.
- order() : string|bool
- Get/set order number of this page.
- orderBy() : string
- Gets and sets the order by which the sub-pages should be sorted.
- orderDir() : string
- Gets and sets the order by which any sub-pages should be sorted.
- orderManual() : array<string|int, mixed>
- Gets the manual order set in the header.
- parent() : PageInterface|null
- Gets and Sets the parent object for this page
- path() : string|null
- Gets and sets the path to the folder where the .md for this Page object resides.
- permalink() : string
- Gets the URL with host information, aka Permalink.
- prevSibling() : PageInterface
- Gets the previous sibling based on current position.
- process() : array<string|int, mixed>
- Gets and Sets the process setup for this Page. This is multi-dimensional array that consists of a simple array of arrays with the form array("markdown"=>true) for example
- publishDate() : int
- Gets and Sets the Page publish date
- published() : bool
- Gets and Sets whether or not this Page is considered published
- raw() : string
- Gets and Sets the raw data
- rawMarkdown() : string
- Gets and Sets the Page raw content
- rawRoute() : null|string
- Gets and Sets the page raw route
- redirect() : string|null
- Gets the redirect set in the header.
- relativePagePath() : string
- Returns the clean path to the page file
- resetMetadata() : mixed
- Reset the metadata and pull from header again
- root() : bool
- Returns whether or not this page is the root node of the pages tree.
- routable() : bool
- Gets and Sets whether or not this Page is routable, ie you can reach it via a URL.
- route() : string|null
- Gets the route for the page based on the route headers if available, else from the parents route and the current Page's slug.
- routeAliases() : array<string|int, mixed>
- Gets the route aliases for the page based on page headers.
- routeCanonical() : bool|string
- Gets the canonical route for this page if its set. If provided it will use that value, else if it's `true` it will use the default route.
- save() : mixed
- Save page if there's a file assigned to it.
- setContentMeta() : array<string|int, mixed>
- Sets the whole content meta array in one shot
- setRawContent() : void
- Needed by the onPageContentProcessed event to set the raw page content
- setSummary() : mixed
- Sets the summary of the page
- shouldProcess() : bool
- Gets the configured state of the processing method.
- slug() : string
- Gets and Sets the slug for the Page. The slug is used in the URL routing. If not set it uses the parent folder from the path
- ssl() : bool
- summary() : string
- Get the summary.
- taxonomy() : array<string|int, mixed>
- Gets and sets the taxonomy array which defines which taxonomies this page identifies itself with.
- template() : string
- Gets and sets the template field. This is used to find the correct Twig template file to render.
- templateFormat() : string
- Allows a page to override the output render format, usually the extension provided in the URL.
- title() : string
- Gets and sets the title for this Page. If no title is set, it will use the slug() to get a name
- toArray() : array<string|int, mixed>
- Convert page to an array.
- toJson() : string
- Convert page to JSON encoded string.
- topParent() : PageInterface
- Gets the top parent object for this page. Can return page itself.
- toYaml() : string
- Convert page to YAML encoded string.
- translatedLanguages() : array<string|int, mixed>
- Return an array with the routes of other translated languages
- unpublishDate() : int|null
- Gets and Sets the Page unpublish date
- unsetRouteSlug() : mixed
- Helper method to clear the route out so it regenerates next time you use it
- untranslatedLanguages() : array<string|int, mixed>
- Return an array listing untranslated languages available
- url() : string
- Gets the url for the Page.
- urlExtension() : string
- Returns the page extension, got from the page `url_extension` config and falls back to the system config `system.pages.append_url_extension`.
- validate() : void
- Validate page header.
- value() : mixed
- Get value from a page variable (used mostly for creating edit forms).
- visible() : bool
- Gets and Sets whether or not this Page is visible for navigation
- adjustRouteCase() : string
- cleanPath() : string
- Cleans the path.
- clearMediaCache() : void
- Clear media cache.
- doReorder() : mixed
- Reorders all siblings according to a defined order
- freeMedia() : void
- getInheritedParams() : array<string|int, mixed>
- Method that contains shared logic for inherited() and inheritedField()
- getMediaCache() : CacheInterface
- normalizeForm() : array<string|int, mixed>|null
- processFrontmatter() : void
- processMarkdown() : void
- Process the Markdown content. Uses Parsedown or Parsedown Extra depending on configuration
- setMedia() : $this
- Sets the associated media collection.
- setPublishState() : void
- processTwig() : void
- Process the Twig page content.
Properties
$_loadMedia
protected
bool
$_loadMedia
= true
$cache_control
protected
string
$cache_control
$content
protected
string|null
$content
$content_meta
protected
array<string|int, mixed>
$content_meta
$date
protected
int
$date
$dateformat
protected
string
$dateformat
$debugger
protected
bool
$debugger
$etag
protected
bool
$etag
$expires
protected
int
$expires
$extension
protected
string
$extension
$external_url
protected
string
$external_url
$folder
protected
string
$folder
$frontmatter
protected
string
$frontmatter
$header
protected
object|null
$header
$hide_home_route
protected
bool
$hide_home_route
$home_route
protected
string
$home_route
$id
protected
string
$id
$initialized
protected
bool
$initialized
= false
$language
protected
string
$language
$last_modified
protected
bool
$last_modified
$markdown_extra
protected
bool
$markdown_extra
$max_count
protected
int
$max_count
$media
protected
MediaCollectionInterface|null
$media
$menu
protected
string
$menu
$metadata
protected
array<string|int, mixed>|null
$metadata
$modified
protected
int
$modified
$modular_twig
protected
bool
$modular_twig
$name
protected
string|null
$name
Filename. Leave as null if page is folder.
$order_by
protected
string
$order_by
$order_dir
protected
string
$order_dir
$order_manual
protected
array<string|int, mixed>|string|null
$order_manual
$parent
protected
string
$parent
$path
protected
string
$path
$process
protected
array<string|int, mixed>
$process
$publish_date
protected
int
$publish_date
$published
protected
bool
$published
$raw_content
protected
string
$raw_content
$raw_route
protected
string|null
$raw_route
$redirect
protected
string
$redirect
$routable
protected
bool
$routable
$route
protected
string|null
$route
$routes
protected
array<string|int, mixed>
$routes
$slug
protected
string
$slug
$ssl
protected
bool
$ssl
$summary
protected
string|null
$summary
$summary_size
protected
int|null
$summary_size
$taxonomy
protected
array<string|int, mixed>
$taxonomy
$template
protected
string
$template
$template_format
protected
string
$template_format
$title
protected
string
$title
$unpublish_date
protected
int|null
$unpublish_date
$url
protected
string
$url
$url_extension
protected
string
$url_extension
$visible
protected
bool
$visible
$_action
private
string
$_action
Action
$_forms
private
array<string|int, mixed>|null
$_forms
$_original
private
PageInterface|null
$_original
Unmodified (original) version of the page. Used for copying and moving the page.
Methods
__clone()
public
__clone() : mixed
Attributes
- #[ReturnTypeWillChange]
__construct()
Page Object Constructor
public
__construct() : mixed
active()
Returns whether or not this page is the currently active page requested via the URL.
public
active() : bool
Return values
bool —True if it is active
activeChild()
Returns whether or not this URI's URL contains the URL of the active page.
public
activeChild() : bool
Or in other words, is this page's URL in the current URL
Return values
bool —True if active child exists
addContentMeta()
Add an entry to the page's contentMeta array
public
addContentMeta(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
addForms()
Add forms to this page.
public
addForms(array<string|int, mixed> $new[, bool $override = true ]) : $this
Parameters
- $new : array<string|int, mixed>
- $override : bool = true
Return values
$thisadjacentSibling()
Returns the adjacent sibling based on a direction.
public
adjacentSibling([int $direction = 1 ]) : PageInterface|false
Parameters
- $direction : int = 1
-
either -1 or +1
Return values
PageInterface|false —the sibling page
ancestor()
Helper method to return an ancestor page.
public
ancestor([bool|null $lookup = null ]) : PageInterface
Parameters
- $lookup : bool|null = null
-
Name of the parent folder
Return values
PageInterface —page you were looking for if it exists
blueprintName()
Get the blueprint name for this page. Use the blueprint form field if set
public
blueprintName() : string
Return values
stringblueprints()
Get blueprints for the page.
public
blueprints() : Blueprint
Return values
BlueprintcacheControl()
Gets and sets the cache-control property. If not set it will return the default value (null) https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control for more details on valid options
public
cacheControl([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
Return values
string|nullcachePageContent()
Fires the onPageContentProcessed event, and caches the page content using a unique ID for the page
public
cachePageContent() : void
canonical()
Returns the canonical URL for a page
public
canonical([bool $include_lang = true ]) : string
Parameters
- $include_lang : bool = true
Return values
stringchildren()
Returns children of this page.
public
children() : PageCollectionInterface|Collection
Return values
PageCollectionInterface|CollectionchildType()
Returns child page type.
public
childType() : string
Return values
stringcollection()
Get a collection of pages in the current context.
public
collection([string|array<string|int, mixed> $params = 'content' ][, bool $pagination = true ]) : PageCollectionInterface|Collection
Parameters
- $params : string|array<string|int, mixed> = 'content'
- $pagination : bool = true
Tags
Return values
PageCollectionInterface|Collectioncontent()
Gets and Sets the content based on content portion of the .md file
public
content([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
Content
Return values
string —Content
contentMeta()
Get the contentMeta array and initialize content first if it's not already
public
contentMeta() : mixed
copy()
Prepare a copy from the page. Copies also everything that's under the current page.
public
copy(PageInterface $parent) : $this
Returns a new Page object for the copy. You need to call $this->save() in order to perform the move.
Parameters
- $parent : PageInterface
-
New parent page.
Return values
$thiscurrentPosition()
Returns the item in the current position.
public
currentPosition() : int|null
Return values
int|null —The index of the current page.
date()
Gets and sets the date for this Page object. This is typically passed in via the page headers
public
date([string|null $var = null ]) : int
Parameters
- $var : string|null = null
-
string representation of a date
Return values
int —unix timestamp representation of the date
dateformat()
Gets and sets the date format for this Page object. This is typically passed in via the page headers using typical PHP date string structure - http://php.net/manual/en/function.date.php
public
dateformat([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
string representation of a date format
Return values
string —string representation of a date format
debugger()
Returns the state of the debugger override setting for this page
public
debugger() : bool
Return values
booleTag()
Gets and sets the option to show the etag header for the page.
public
eTag([bool|null $var = null ]) : bool
Parameters
- $var : bool|null = null
-
show etag header
Return values
bool —show etag header
evaluate()
public
evaluate(string|array<string|int, mixed> $value[, bool $only_published = true ]) : PageCollectionInterface|Collection
Parameters
- $value : string|array<string|int, mixed>
- $only_published : bool = true
Return values
PageCollectionInterface|Collectionexists()
Returns whether the page exists in the filesystem.
public
exists() : bool
Return values
boolexpires()
Gets and sets the expires field. If not set will return the default
public
expires([int|null $var = null ]) : int
Parameters
- $var : int|null = null
-
The new expires value.
Return values
int —The expires value
extension()
Gets and sets the extension field.
public
extension([string|null $var = null ]) : string
Parameters
- $var : string|null = null
Return values
stringextra()
Get unknown header variables.
public
extra() : array<string|int, mixed>
Return values
array<string|int, mixed>file()
Get file object to the page.
public
file() : MarkdownFile|null
Return values
MarkdownFile|nullfilePath()
Gets and sets the path to the .md file for this Page object.
public
filePath([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
the file path
Return values
string|null —the file path
filePathClean()
Gets the relative path to the .md file
public
filePathClean() : string
Return values
string —The relative file path
filter()
Filter page header from illegal contents.
public
filter() : void
find()
Helper method to return a page.
public
find(string $url[, bool $all = false ]) : PageInterface
Parameters
- $url : string
-
the url of the page
- $all : bool = false
Return values
PageInterface —page you were looking for if it exists
folder()
Get/set the folder.
public
folder([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
Optional path
Return values
string|nullfolderExists()
Returns whether or not the current folder exists
public
folderExists() : bool
Return values
boolforms()
Alias of $this->getForms();
public
forms() : array<string|int, mixed>
Return values
array<string|int, mixed>frontmatter()
Gets and Sets the page frontmatter
public
frontmatter([string|null $var = null ]) : string
Parameters
- $var : string|null = null
Return values
stringgetAction()
Gets the action.
public
getAction() : string|null
Return values
string|null —The Action string.
getBlueprint()
Returns the blueprint from the page.
public
getBlueprint([string $name = '' ]) : Blueprint
Parameters
- $name : string = ''
-
Not used.
Return values
Blueprint —Returns a Blueprint.
getCacheKey()
public
getCacheKey() : string
Return values
stringgetContentMeta()
Return the whole contentMeta array as it currently stands
public
getContentMeta([string|null $name = null ]) : mixed|null
Parameters
- $name : string|null = null
Return values
mixed|nullgetForms()
Return all the forms which are associated to this page.
public
getForms() : array<string|int, mixed>
Forms are returned as [name => blueprint, ...], where blueprint follows the regular form blueprint format.
Return values
array<string|int, mixed>getMedia()
Gets the associated media collection.
public
getMedia() : MediaCollectionInterface|Media
Return values
MediaCollectionInterface|Media —Representation of associated media.
getMediaFolder()
Get filesystem path to the associated media.
public
getMediaFolder() : string|null
Return values
string|nullgetMediaOrder()
Get display order for the associated media.
public
getMediaOrder() : array<string|int, mixed>
Return values
array<string|int, mixed> —Empty array means default ordering.
getMediaUri()
Get URI ot the associated media. Method will return null if path isn't URI.
public
getMediaUri() : string|null
Return values
string|nullgetOriginal()
Gets the Page Unmodified (original) version of the page.
public
getOriginal() : PageInterface
Return values
PageInterface —The original version of the page.
getRawContent()
Needed by the onPageContentProcessed event to get the raw page content
public
getRawContent() : string
Return values
string —the current page content
header()
Gets and Sets the header based on the YAML configuration at the top of the .md file
public
header([object|array<string|int, mixed>|null $var = null ]) : stdClass
Parameters
- $var : object|array<string|int, mixed>|null = null
-
a YAML object representing the configuration for the file
Return values
stdClass —the current YAML configuration
home()
Returns whether or not this page is the currently configured home page.
public
home() : bool
Return values
bool —True if it is the homepage
httpHeaders()
public
httpHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>httpResponseCode()
public
httpResponseCode() : int
Return values
intid()
Gets and sets the identifier for this Page object.
public
id([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
the identifier
Return values
string —the identifier
inherited()
Helper method to return an ancestor page to inherit from. The current page object is returned.
public
inherited(string $field) : PageInterface
Parameters
- $field : string
-
Name of the parent folder
Return values
PageInterfaceinheritedField()
Helper method to return an ancestor field only to inherit from. The first occurrence of an ancestor field will be returned if at all.
public
inheritedField(string $field) : array<string|int, mixed>
Parameters
- $field : string
-
Name of the parent folder
Return values
array<string|int, mixed>init()
Initializes the page instance variables based on a file
public
init(SplFileInfo $file[, string|null $extension = null ]) : $this
Parameters
- $file : SplFileInfo
-
The file information for the .md file that the page represents
- $extension : string|null = null
Return values
$thisinitialize()
public
initialize() : void
isDir()
Returns whether or not this Page object is a directory or a page.
public
isDir() : bool
Return values
bool —True if its a directory
isFirst()
Check to see if this item is the first in an array of sub-pages.
public
isFirst() : bool
Return values
bool —True if item is first.
isLast()
Check to see if this item is the last in an array of sub-pages.
public
isLast() : bool
Return values
bool —True if item is last
isModule()
Returns true if page is a module.
public
isModule() : bool
Return values
boolisPage()
Returns whether or not this Page object has a .md file associated with it or if its just a directory.
public
isPage() : bool
Return values
bool —True if its a page with a .md file associated
language()
Get page language
public
language([string|null $var = null ]) : mixed
Parameters
- $var : string|null = null
lastModified()
Gets and sets the option to show the last_modified header for the page.
public
lastModified([bool|null $var = null ]) : bool
Parameters
- $var : bool|null = null
-
show last_modified header
Return values
bool —show last_modified header
link()
Gets the URL for a page - alias of url().
public
link([bool $include_host = false ]) : string
Parameters
- $include_host : bool = false
Return values
string —the permalink
maxCount()
Gets and sets the maxCount field which describes how many sub-pages should be displayed if the sub_pages header property is set for this page object.
public
maxCount([int|null $var = null ]) : int
Parameters
- $var : int|null = null
-
the maximum number of sub-pages
Return values
int —the maximum number of sub-pages
media()
Gets and sets the associated media as found in the page folder.
public
media([Media|null $var = null ]) : Media
Parameters
- $var : Media|null = null
-
Representation of associated media.
Return values
Media —Representation of associated media.
menu()
Gets and sets the menu name for this Page. This is the text that can be used specifically for navigation.
public
menu([string|null $var = null ]) : string
If no menu field is set, it will use the title()
Parameters
- $var : string|null = null
-
the menu field for the page
Return values
string —the menu field for the page
metadata()
Function to merge page metadata tags and build an array of Metadata objects that can then be rendered in the page.
public
metadata([array<string|int, mixed>|null $var = null ]) : array<string|int, mixed>
Parameters
- $var : array<string|int, mixed>|null = null
-
an Array of metadata values to set
Return values
array<string|int, mixed> —an Array of metadata values for the page
modified()
Gets and sets the modified timestamp.
public
modified([int|null $var = null ]) : int
Parameters
- $var : int|null = null
-
modified unix timestamp
Return values
int —modified unix timestamp
modifyHeader()
Modify a header value directly
public
modifyHeader(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
modular()
Gets and sets the modular var that helps identify this page is a modular child
public
modular([bool|null $var = null ]) : bool
Use ->isModule() or ->modularTwig() method instead.
Parameters
- $var : bool|null = null
-
true if modular_twig
Return values
bool —true if modular_twig
modularTwig()
Gets and sets the modular_twig var that helps identify this page as a modular child page that will need twig processing handled differently from a regular page.
public
modularTwig([bool|null $var = null ]) : bool
Parameters
- $var : bool|null = null
-
true if modular_twig
Return values
bool —true if modular_twig
move()
Prepare move page to new location. Moves also everything that's under the current page.
public
move(PageInterface $parent) : $this
You need to call $this->save() in order to perform the move.
Parameters
- $parent : PageInterface
-
New parent page.
Return values
$thisname()
Gets and sets the name field. If no name field is set, it will return 'default.md'.
public
name([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
The name of this page.
Return values
string —The name of this page.
nextSibling()
Gets the next sibling based on current position.
public
nextSibling() : PageInterface
Return values
PageInterface —the next Page item
order()
Get/set order number of this page.
public
order([int|null $var = null ]) : string|bool
Parameters
- $var : int|null = null
Return values
string|boolorderBy()
Gets and sets the order by which the sub-pages should be sorted.
public
orderBy([string|null $var = null ]) : string
default - is the order based on the file system, ie 01.Home before 02.Advark title - is the order based on the title set in the pages date - is the order based on the date set in the pages folder - is the order based on the name of the folder with any numerics omitted
Parameters
- $var : string|null = null
-
supported options include "default", "title", "date", and "folder"
Return values
string —supported options include "default", "title", "date", and "folder"
orderDir()
Gets and sets the order by which any sub-pages should be sorted.
public
orderDir([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
the order, either "asc" or "desc"
Return values
string —the order, either "asc" or "desc"
orderManual()
Gets the manual order set in the header.
public
orderManual([string|null $var = null ]) : array<string|int, mixed>
Parameters
- $var : string|null = null
-
supported options include "default", "title", "date", and "folder"
Return values
array<string|int, mixed>parent()
Gets and Sets the parent object for this page
public
parent([PageInterface|null $var = null ]) : PageInterface|null
Parameters
- $var : PageInterface|null = null
-
the parent page object
Return values
PageInterface|null —the parent page object if it exists.
path()
Gets and sets the path to the folder where the .md for this Page object resides.
public
path([string|null $var = null ]) : string|null
This is equivalent to the filePath but without the filename.
Parameters
- $var : string|null = null
-
the path
Return values
string|null —the path
permalink()
Gets the URL with host information, aka Permalink.
public
permalink() : string
Return values
string —The permalink.
prevSibling()
Gets the previous sibling based on current position.
public
prevSibling() : PageInterface
Return values
PageInterface —the previous Page item
process()
Gets and Sets the process setup for this Page. This is multi-dimensional array that consists of a simple array of arrays with the form array("markdown"=>true) for example
public
process([array<string|int, mixed>|null $var = null ]) : array<string|int, mixed>
Parameters
- $var : array<string|int, mixed>|null = null
-
an Array of name value pairs where the name is the process and value is true or false
Return values
array<string|int, mixed> —an Array of name value pairs where the name is the process and value is true or false
publishDate()
Gets and Sets the Page publish date
public
publishDate([string|null $var = null ]) : int
Parameters
- $var : string|null = null
-
string representation of a date
Return values
int —unix timestamp representation of the date
published()
Gets and Sets whether or not this Page is considered published
public
published([bool|null $var = null ]) : bool
Parameters
- $var : bool|null = null
-
true if the page is published
Return values
bool —true if the page is published
raw()
Gets and Sets the raw data
public
raw([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
Raw content string
Return values
string —Raw content string
rawMarkdown()
Gets and Sets the Page raw content
public
rawMarkdown([string|null $var = null ]) : string
Parameters
- $var : string|null = null
Return values
stringrawRoute()
Gets and Sets the page raw route
public
rawRoute([string|null $var = null ]) : null|string
Parameters
- $var : string|null = null
Return values
null|stringredirect()
Gets the redirect set in the header.
public
redirect([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
redirect url
Return values
string|nullrelativePagePath()
Returns the clean path to the page file
public
relativePagePath() : string
Return values
stringresetMetadata()
Reset the metadata and pull from header again
public
resetMetadata() : mixed
root()
Returns whether or not this page is the root node of the pages tree.
public
root() : bool
Return values
bool —True if it is the root
routable()
Gets and Sets whether or not this Page is routable, ie you can reach it via a URL.
public
routable([bool|null $var = null ]) : bool
The page must be routable and published
Parameters
- $var : bool|null = null
-
true if the page is routable
Return values
bool —true if the page is routable
route()
Gets the route for the page based on the route headers if available, else from the parents route and the current Page's slug.
public
route([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
Set new default route.
Return values
string|null —The route for the Page.
routeAliases()
Gets the route aliases for the page based on page headers.
public
routeAliases([array<string|int, mixed>|null $var = null ]) : array<string|int, mixed>
Parameters
- $var : array<string|int, mixed>|null = null
-
list of route aliases
Return values
array<string|int, mixed> —The route aliases for the Page.
routeCanonical()
Gets the canonical route for this page if its set. If provided it will use that value, else if it's `true` it will use the default route.
public
routeCanonical([string|null $var = null ]) : bool|string
Parameters
- $var : string|null = null
Return values
bool|stringsave()
Save page if there's a file assigned to it.
public
save([bool|array<string|int, mixed> $reorder = true ]) : mixed
Parameters
- $reorder : bool|array<string|int, mixed> = true
-
Internal use.
setContentMeta()
Sets the whole content meta array in one shot
public
setContentMeta(array<string|int, mixed> $content_meta) : array<string|int, mixed>
Parameters
- $content_meta : array<string|int, mixed>
Return values
array<string|int, mixed>setRawContent()
Needed by the onPageContentProcessed event to set the raw page content
public
setRawContent(string|null $content) : void
Parameters
- $content : string|null
setSummary()
Sets the summary of the page
public
setSummary(string $summary) : mixed
Parameters
- $summary : string
-
Summary
shouldProcess()
Gets the configured state of the processing method.
public
shouldProcess(string $process) : bool
Parameters
- $process : string
-
the process, eg "twig" or "markdown"
Return values
bool —whether or not the processing method is enabled for this Page
slug()
Gets and Sets the slug for the Page. The slug is used in the URL routing. If not set it uses the parent folder from the path
public
slug([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
the slug, e.g. 'my-blog'
Return values
string —the slug
ssl()
public
ssl([bool|null $var = null ]) : bool
Parameters
- $var : bool|null = null
Return values
boolsummary()
Get the summary.
public
summary([int|null $size = null ][, bool $textOnly = false ]) : string
Parameters
- $size : int|null = null
-
Max summary size.
- $textOnly : bool = false
-
Only count text size.
Return values
stringtaxonomy()
Gets and sets the taxonomy array which defines which taxonomies this page identifies itself with.
public
taxonomy([array<string|int, mixed>|null $var = null ]) : array<string|int, mixed>
Parameters
- $var : array<string|int, mixed>|null = null
-
an array of taxonomies
Return values
array<string|int, mixed> —an array of taxonomies
template()
Gets and sets the template field. This is used to find the correct Twig template file to render.
public
template([string|null $var = null ]) : string
If no field is set, it will return the name without the .md extension
Parameters
- $var : string|null = null
-
the template name
Return values
string —the template name
templateFormat()
Allows a page to override the output render format, usually the extension provided in the URL.
public
templateFormat([string|null $var = null ]) : string
(e.g. html, json, xml, etc).
Parameters
- $var : string|null = null
Return values
stringtitle()
Gets and sets the title for this Page. If no title is set, it will use the slug() to get a name
public
title([string|null $var = null ]) : string
Parameters
- $var : string|null = null
-
the title of the Page
Return values
string —the title of the Page
toArray()
Convert page to an array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toJson()
Convert page to JSON encoded string.
public
toJson() : string
Return values
stringtopParent()
Gets the top parent object for this page. Can return page itself.
public
topParent() : PageInterface
Return values
PageInterface —The top parent page object.
toYaml()
Convert page to YAML encoded string.
public
toYaml() : string
Return values
stringtranslatedLanguages()
Return an array with the routes of other translated languages
public
translatedLanguages([bool $onlyPublished = false ]) : array<string|int, mixed>
Parameters
- $onlyPublished : bool = false
-
only return published translations
Return values
array<string|int, mixed> —the page translated languages
unpublishDate()
Gets and Sets the Page unpublish date
public
unpublishDate([string|null $var = null ]) : int|null
Parameters
- $var : string|null = null
-
string representation of a date
Return values
int|null —unix timestamp representation of the date
unsetRouteSlug()
Helper method to clear the route out so it regenerates next time you use it
public
unsetRouteSlug() : mixed
untranslatedLanguages()
Return an array listing untranslated languages available
public
untranslatedLanguages([bool $includeUnpublished = false ]) : array<string|int, mixed>
Parameters
- $includeUnpublished : bool = false
-
also list unpublished translations
Return values
array<string|int, mixed> —the page untranslated languages
url()
Gets the url for the Page.
public
url([bool $include_host = false ][, bool $canonical = false ][, bool $include_base = true ][, bool $raw_route = false ]) : string
Parameters
- $include_host : bool = false
-
Defaults false, but true would include http://yourhost.com
- $canonical : bool = false
-
True to return the canonical URL
- $include_base : bool = true
-
Include base url on multisite as well as language code
- $raw_route : bool = false
Return values
string —The url.
urlExtension()
Returns the page extension, got from the page `url_extension` config and falls back to the system config `system.pages.append_url_extension`.
public
urlExtension() : string
Return values
string —The extension of this page. For example .html
validate()
Validate page header.
public
validate() : void
Tags
value()
Get value from a page variable (used mostly for creating edit forms).
public
value(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
-
Variable name.
- $default : mixed = null
visible()
Gets and Sets whether or not this Page is visible for navigation
public
visible([bool|null $var = null ]) : bool
Parameters
- $var : bool|null = null
-
true if the page is visible
Return values
bool —true if the page is visible
adjustRouteCase()
protected
adjustRouteCase(string $route) : string
Parameters
- $route : string
Return values
stringcleanPath()
Cleans the path.
protected
cleanPath(string $path) : string
Parameters
- $path : string
-
the path
Return values
string —the path
clearMediaCache()
Clear media cache.
protected
clearMediaCache() : void
doReorder()
Reorders all siblings according to a defined order
protected
doReorder(array<string|int, mixed>|null $new_order) : mixed
Parameters
- $new_order : array<string|int, mixed>|null
freeMedia()
protected
freeMedia() : void
getInheritedParams()
Method that contains shared logic for inherited() and inheritedField()
protected
getInheritedParams(string $field) : array<string|int, mixed>
Parameters
- $field : string
-
Name of the parent folder
Return values
array<string|int, mixed>getMediaCache()
protected
getMediaCache() : CacheInterface
Return values
CacheInterfacenormalizeForm()
protected
normalizeForm(array<string|int, mixed>|null $form[, string|null $name = null ][, array<string|int, mixed> $rules = [] ]) : array<string|int, mixed>|null
Parameters
- $form : array<string|int, mixed>|null
- $name : string|null = null
- $rules : array<string|int, mixed> = []
Return values
array<string|int, mixed>|nullprocessFrontmatter()
protected
processFrontmatter() : void
processMarkdown()
Process the Markdown content. Uses Parsedown or Parsedown Extra depending on configuration
protected
processMarkdown([bool $keepTwig = false ]) : void
Parameters
- $keepTwig : bool = false
-
If true, content between twig tags will not be processed.
setMedia()
Sets the associated media collection.
protected
setMedia(MediaCollectionInterface|Media $media) : $this
Parameters
- $media : MediaCollectionInterface|Media
-
Representation of associated media.
Return values
$thissetPublishState()
protected
setPublishState() : void
processTwig()
Process the Twig page content.
private
processTwig() : void