PageLegacyTrait
Implements PageLegacyInterface
Table of Contents
Properties
- $_content_meta : array<string|int, mixed>|null
- $_metadata : array<string|int, mixed>|null
Methods
- addContentMeta() : void
- Add an entry to the page's contentMeta array
- adjacentSibling() : PageInterface|false
- Returns the adjacent sibling based on a direction.
- ancestor() : PageInterface|null
- Helper method to return an ancestor page.
- blueprintName() : string
- Get the blueprint name for this page. Use the blueprint form field if set
- 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
- children() : PageCollectionInterface|FlexIndexInterface
- Returns children of this page.
- childType() : string
- Returns child page type.
- collection() : PageCollectionInterface|Collection
- Get a collection of pages in the current context.
- contentMeta() : array<string|int, 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.
- 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
- 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|null
- Gets the relative path to the .md file
- filter() : void
- Filter page header from illegal contents.
- find() : PageInterface|null
- Helper method to return a page.
- folderExists() : bool
- Returns whether or not the current folder exists
- frontmatter() : string
- Gets and Sets the page frontmatter
- getAction() : string|null
- Gets the action.
- getContentMeta() : string|array<string|int, mixed>|null
- Return the whole contentMeta array as it currently stands
- httpHeaders() : array<string|int, mixed>
- httpResponseCode() : int
- inherited() : PageInterface|null
- 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
- 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.
- 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.
- 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.
- modifyHeader() : void
- 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|false
- Gets the next sibling based on current position.
- 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.
- prevSibling() : PageInterface|false
- Gets the previous sibling based on current position.
- raw() : string
- Gets and Sets the raw data
- resetMetadata() : void
- Reset the metadata and pull from header again
- setContentMeta() : array<string|int, mixed>
- Sets the whole content meta array in one shot
- ssl() : bool|null
- 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.
- toArray() : array<string|int, mixed>
- Convert page to an array.
- toJson() : string
- Convert page to JSON encoded string.
- toYaml() : string
- Convert page to YAML encoded string.
- validate() : void
- Validate page header.
- getInheritedParams() : array<string|int, mixed>
- Method that contains shared logic for inherited() and inheritedField()
Properties
$_content_meta
private
array<string|int, mixed>|null
$_content_meta
$_metadata
private
array<string|int, mixed>|null
$_metadata
Methods
addContentMeta()
Add an entry to the page's contentMeta array
public
addContentMeta(string $name, string $value) : void
Parameters
- $name : string
- $value : string
adjacentSibling()
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([string|null $lookup = null ]) : PageInterface|null
Parameters
- $lookup : string|null = null
-
Name of the parent folder
Return values
PageInterface|null —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
stringcacheControl()
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
children()
Returns children of this page.
public
children() : PageCollectionInterface|FlexIndexInterface
Return values
PageCollectionInterface|FlexIndexInterfacechildType()
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|CollectioncontentMeta()
Get the contentMeta array and initialize content first if it's not already
public
contentMeta() : array<string|int, mixed>
Return values
array<string|int, mixed>copy()
Prepare a copy from the page. Copies also everything that's under the current page.
public
copy([PageInterface|null $parent = null ]) : $this
Returns a new Page object for the copy. You need to call $this->save() in order to perform the move.
Parameters
- $parent : PageInterface|null = null
-
New parent page.
Return values
$thisdebugger()
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|Collectionexpires()
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|null
Return values
string|null —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|null
Parameters
- $url : string
-
the url of the page
- $all : bool = false
Return values
PageInterface|null —page you were looking for if it exists
folderExists()
Returns whether or not the current folder exists
public
folderExists() : bool
Return values
boolfrontmatter()
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.
getContentMeta()
Return the whole contentMeta array as it currently stands
public
getContentMeta([string|null $name = null ]) : string|array<string|int, mixed>|null
Parameters
- $name : string|null = null
Return values
string|array<string|int, mixed>|nullhttpHeaders()
public
httpHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>httpResponseCode()
public
httpResponseCode() : int
Return values
intinherited()
Helper method to return an ancestor page to inherit from. The current page object is returned.
public
inherited(string $field) : PageInterface|null
Parameters
- $field : string
-
Name of the parent folder
Return values
PageInterface|nullinheritedField()
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
$thisisFirst()
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
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
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
modifyHeader()
Modify a header value directly
public
modifyHeader(string $key, string|array<string|int, mixed> $value) : void
Parameters
- $key : string
- $value : string|array<string|int, 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|false
Return values
PageInterface|false —the next Page item
orderBy()
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>prevSibling()
Gets the previous sibling based on current position.
public
prevSibling() : PageInterface|false
Return values
PageInterface|false —the previous Page item
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
resetMetadata()
Reset the metadata and pull from header again
public
resetMetadata() : void
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>ssl()
public
ssl([bool|null $var = null ]) : bool|null
Parameters
- $var : bool|null = null
Return values
bool|nulltemplate()
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
stringtoArray()
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
stringtoYaml()
Convert page to YAML encoded string.
public
toYaml() : string
Return values
stringvalidate()
Validate page header.
public
validate() : void
Tags
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