PageObject
extends FlexPageObject
in package
uses
FlexGravTrait, FlexObjectTrait, PageContentTrait, PageLegacyTrait, PageRoutableTrait, PageTranslateTrait
Class GravPageObject
Table of Contents
Constants
- PAGE_ORDER_PREFIX_REGEX = '/^[0-9]+\./u'
- PAGE_ORDER_REGEX = '/^(\d+)\.(.*)$/u'
Properties
- $folder : string
- $name : string
- $order : int|false
- $route : string
- $slug : string
- $template : string
- $_content : string|null
- $_original : array<string|int, mixed>|null
- $_originalObject : FlexPageObject|null
- $_reorder : array<string|int, mixed>|null
- $_summary : string|null
- $_uploads : array<string|int, mixed>
- $calculatedProperties : array<string|int, mixed>
- $format : string
- $header : object|null
- $headerProperties : array<string|int, mixed>
- $language : string
- $root : bool
- $storage_key : string|null
- $storage_timestamp : int|null
- $type : string
- $_authors : array<int, UserInterface>
- $_content_meta : array<string|int, mixed>|null
- $_forms : array<string|int, mixed>|null
- $_initialized : bool
- $_key : string
- $_languages : array<string|int, mixed>|null
- $_metadata : array<string|int, mixed>|null
- $_parentCache : PageInterface|null
- $_path : string|null
- $_permissionsCache : array<string|int, mixed>|null
- $_route : string|null
- $_translations : array<string|int, PageInterface>
Methods
- __clone() : mixed
- Clone page.
- __construct() : mixed
- Construct a new Flex Object instance.
- __debugInfo() : array<string|int, mixed>
- __get() : mixed
- Returns the value at specified offset.
- __isset() : bool
- Checks whether or not an offset exists.
- __serialize() : array<string|int, mixed>
- __set() : void
- Assigns a value to the specified offset.
- __toString() : string
- Returns a string representation of this object.
- __unserialize() : void
- __unset() : void
- Magic method to unset the attribute
- 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() : void
- 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|null
- 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
- Alias of getBlueprint()
- 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
- check() : void
- checkMediaFilename() : void
- children() : FlexIndexInterface|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
- 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.
- create() : static
- Create new object into the storage.
- createCopy() : FlexObjectInterface
- createFromStorage() : static
- currentPosition() : int|null
- Returns the item in the current position.
- date() : int
- dateformat() : string|null
- debugger() : bool
- Returns the state of the debugger override setting for this page
- defNestedProperty() : $this
- defProperty() : $this
- delete() : static
- Delete object from the storage.
- eTag() : bool
- Gets and sets the option to show the etag header for the page.
- evaluate() : PageCollectionInterface|Collection
- exists() : bool
- Returns true if the object exists in the storage.
- 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.
- filterBy() : bool
- Filter page (true/false) by given filters.
- find() : PageInterface|null
- Helper method to return a page.
- findTranslation() : string|null
- 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
- full_order() : string
- getAction() : string|null
- Gets the action.
- getAllLanguages() : array<string|int, mixed>
- getAuthors() : array<int, UserInterface>
- Get list of all author objects.
- getBlueprint() : Blueprint
- Returns the blueprint of the object.
- getCache() : CacheInterface
- getCacheChecksum() : string
- Get cache checksum for the object / collection.
- getCachedMethods() : array<string|int, mixed>
- getCacheKey() : string
- Get a cache key which is used for caching the object / collection.
- getChanges() : array<string|int, mixed>
- Get any changes from the object.
- getContentMeta() : string|array<string|int, mixed>|null
- Return the whole contentMeta array as it currently stands
- getCreated_Timestamp() : int
- getDefaultValue() : mixed|null
- Returns default value suitable to be used in a form for the given property.
- getDefaultValues() : array<string|int, mixed>
- Returns default values suitable to be used in a form for the given property.
- getDiff() : array<string|int, mixed>
- Get diff array from the object.
- getFieldSettings() : array<string|int, mixed>|null
- getFlexDirectory() : FlexDirectory
- getFlexFeatures() : array<string|int, mixed>
- Get full list of features the object / collection implements.
- getFlexKey() : string
- Get a unique key for the object.
- getFlexType() : string
- Get Flex Type of the object / collection.
- getForm() : FlexFormInterface
- Returns a form instance for the object.
- getForms() : array<string|int, mixed>
- Return all the forms which are associated to this page.
- getFormValue() : mixed
- Returns raw value suitable to be used in a form for the given property.
- getKey() : string
- getLanguage() : string
- getLanguages() : array<string|int, mixed>
- Returns all translated languages.
- getLevelListing() : array<string|int, mixed>
- getMasterKey() : string
- Get master storage key.
- getMedia() : MediaCollectionInterface
- getMediaField() : MediaCollectionInterface|null
- getMediaFolder() : string|null
- getMediaOrder() : array<string|int, mixed>
- Get display order for the associated media.
- getMetaData() : array<string|int, mixed>
- Get index data associated to the object.
- getNestedProperty() : mixed
- getOriginal() : FlexPageObject|null
- Gets the Page Unmodified (original) version of the page.
- getOriginalData() : array<string|int, mixed>
- Get original data before update
- getPermissions() : array<string|int, mixed>
- getProperty() : mixed
- getPublish_Timestamp() : int
- getRawContent() : string
- getRoute() : Route|null
- getStorageFolder() : string|null
- getStorageKey() : string
- getTimestamp() : int
- Get last updated timestamp for the object / collection.
- getTranslation() : FlexObjectInterface|PageInterface|null
- getType() : string
- getUnpublish_Timestamp() : int|null
- getUpdated_Timestamp() : int
- hasAuthor() : bool
- Returns true if object has the named author.
- hasFlexFeature() : bool
- Test whether the feature is implemented in the object / collection.
- hasKey() : bool
- hasNestedProperty() : bool
- hasProperty() : bool
- hasTranslation() : bool
- header() : Header
- home() : bool
- Returns whether or not this page is the currently configured home page.
- httpHeaders() : array<string|int, mixed>
- httpResponseCode() : int
- id() : string
- 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
- initialize() : void
- isAuthorized() : bool|null
- Check if user is authorized for the action.
- isDir() : bool
- 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
- isOrdered() : bool
- isPage() : bool
- isParentAuthorized() : bool|null
- isPublished() : bool
- isRoutable() : bool
- isVisible() : bool
- jsonSerialize() : array<string|int, mixed>
- language() : string|null
- Get page language
- lastModified() : bool
- 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
- menu() : string
- 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
- 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.
- offsetExists() : bool
- Whether or not an offset exists.
- offsetGet() : mixed
- Returns the value at specified offset.
- offsetSet() : void
- Assigns a value to the specified offset.
- offsetUnset() : void
- Unsets an offset.
- order() : mixed
- 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
- parentStorageKey() : string|null
- Get/set the folder.
- 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.
- prepareStorage() : array<string|int, mixed>
- Prepare object for saving into the storage.
- prevSibling() : PageInterface|false
- Gets the previous sibling based on current position.
- process() : array<string|int, mixed>
- publishDate() : int|null
- published() : bool
- raw() : string
- Gets and Sets the raw data
- rawMarkdown() : string
- rawRoute() : string|null
- Gets and Sets the page raw route
- redirect() : string|null
- Gets the redirect set in the header.
- refresh() : bool
- Refresh object from the storage.
- relativePagePath() : string|null
- Returns the clean path to the page file
- render() : ContentBlockInterface|HtmlBlock
- Renders the object.
- resetMetadata() : void
- 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() : string|null
- 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() : static
- Save object into the storage.
- search() : float
- Search a string from the object, returns weight between 0 and 1.
- searchNestedProperty() : float
- searchProperty() : float
- setContentMeta() : array<string|int, mixed>
- Sets the whole content meta array in one shot
- setFlexDirectory() : void
- setNestedProperty() : $this
- setProperty() : $this
- setRawContent() : void
- setStorageKey() : $this
- setSummary() : void
- setTimestamp() : $this
- shouldProcess() : bool
- slug() : mixed
- ssl() : bool|null
- storeOriginal() : void
- Store the Page Unmodified (original) version of the page.
- summary() : string
- taxonomy() : array<string|int, mixed>
- 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
- 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.
- translated() : bool
- translatedLanguages() : array<string|int, mixed>
- Return an array with the routes of other translated languages
- triggerEvent() : $this
- unpublishDate() : int|null
- unsetNestedProperty() : $this
- unsetProperty() : $this
- unsetRouteSlug() : void
- 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
- update() : static
- Updates object in the memory.
- 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
- visible() : bool
- addUpdatedMedia() : void
- buildMediaList() : array<string|int, mixed>
- buildMediaObject() : MediaObject|UploadedMediaObject
- createFormObject() : FlexFormInterface
- This methods allows you to override form objects in child classes.
- createMedium() : Medium|null
- doGetBlueprint() : Blueprint
- doGetProperty() : mixed
- doHasProperty() : bool
- doSerialize() : array<string|int, mixed>
- doSetProperty() : void
- doUnserialize() : void
- doUnsetProperty() : void
- filterElements() : void
- Filter data coming to constructor or $this->update() request.
- freeMedia() : void
- getActiveUser() : UserInterface|null
- getAuthorizeAction() : string
- getAuthorizeRule() : string
- getAuthorizeScope() : string
- getCollectionByProperty() : FlexCollectionInterface<string|int, FlexObjectInterface>
- getContainer() : Grav
- getElement() : mixed|null
- getElements() : array<string|int, mixed>
- getFallbackLanguages() : array<string|int, mixed>
- getFieldDateTime() : DateTime|null
- getFieldTimestamp() : int|null
- getFlexContainer() : Flex
- getInheritedParams() : array<string|int, mixed>
- Method that contains shared logic for inherited() and inheritedField()
- getLanguageTemplates() : array<string|int, mixed>
- getMediaCache() : CacheInterface
- getMediaFields() : array<string|int, mixed>
- getRelatedDirectory() : FlexDirectory
- getStorage() : array<string|int, mixed>
- getTemplate() : Template|TemplateWrapper
- getTemplateConfig() : array<string|int, mixed>
- getTemplatePaths() : array<string|int, mixed>
- getTypePrefix() : string
- getUpdatedMedia() : array<string, UploadedFileInterface|array<string|int, mixed>|null>
- isAdminSite() : bool
- isAuthorizedAction() : bool|null
- Check if user is authorized for the action.
- isAuthorizedByGroup() : bool|null
- Group authorization works as follows:
- isAuthorizedOverride() : bool|null
- isAuthorizedSuperAdmin() : bool|null
- isMoved() : bool
- loadAuthors() : array<int, UserInterface>
- loadHeaderProperty() : mixed|null
- Common logic to load header properties.
- loadPermissions() : array<string|int, mixed>
- loadProperty() : mixed|null
- Common logic to load header properties.
- markAsCopy() : void
- normalizeForm() : array<string|int, mixed>|null
- offsetLoad_header() : Header
- offsetLoad_media() : MediaCollectionInterface
- offsetPrepare_header() : Header
- offsetSerialize_header() : array<string|int, mixed>
- offsetSerialize_media() : null
- onAfterSave() : void
- onBeforeSave() : array<string|int, mixed>
- onSave() : array<string|int, mixed>
- pageContentValue() : mixed
- parseFileProperty() : array<string|int, mixed>|mixed
- processContent() : string
- Gets and Sets the content based on content portion of the .md file
- processMarkdown() : string
- Process the Markdown content.
- processSummary() : string
- processTwig() : string
- Process the Twig page content.
- reorderSiblings() : PageCollection|null
- resetBlueprints() : void
- Method to reset blueprints if the type changes.
- routeInternal() : string|null
- saveUpdatedMedia() : void
- searchValue() : float
- setKey() : $this
- setMetaData() : void
- setStorage() : void
- setUpdatedMedia() : void
Constants
PAGE_ORDER_PREFIX_REGEX
public
mixed
PAGE_ORDER_PREFIX_REGEX
= '/^[0-9]+\./u'
PAGE_ORDER_REGEX
public
mixed
PAGE_ORDER_REGEX
= '/^(\d+)\.(.*)$/u'
Properties
$folder
public
string
$folder
$name
public
string
$name
$order
public
int|false
$order
$route
public
string
$route
$slug
public
string
$slug
$template
public
string
$template
$_content
protected
string|null
$_content
$_original
protected
array<string|int, mixed>|null
$_original
$_originalObject
protected
FlexPageObject|null
$_originalObject
$_reorder
protected
array<string|int, mixed>|null
$_reorder
$_summary
protected
string|null
$_summary
$_uploads
protected
array<string|int, mixed>
$_uploads
= []
$calculatedProperties
protected
static array<string|int, mixed>
$calculatedProperties
= ['name' => 'name', 'parent' => 'parent', 'parent_key' => 'parentStorageKey', 'folder' => 'folder', 'order' => 'order', 'template' => 'template']
$format
protected
string
$format
File format, eg. 'md'
$header
protected
object|null
$header
$headerProperties
protected
static array<string|int, mixed>
$headerProperties
= ['slug' => 'slug', 'routes' => false, 'title' => 'title', 'language' => 'language', 'template' => 'template', 'menu' => 'menu', 'routable' => 'routable', 'visible' => 'visible', 'redirect' => 'redirect', 'external_url' => false, 'order_dir' => 'orderDir', 'order_by' => 'orderBy', 'order_manual' => 'orderManual', 'dateformat' => 'dateformat', 'date' => 'date', 'markdown_extra' => false, 'taxonomy' => 'taxonomy', 'max_count' => 'maxCount', 'process' => 'process', 'published' => 'published', 'publish_date' => 'publishDate', 'unpublish_date' => 'unpublishDate', 'expires' => 'expires', 'cache_control' => 'cacheControl', 'etag' => 'eTag', 'last_modified' => 'lastModified', 'ssl' => 'ssl', 'template_format' => 'templateFormat', 'debugger' => false]
$language
protected
string
$language
Language code, eg: 'en'
$root
protected
bool
$root
= false
$storage_key
protected
string|null
$storage_key
$storage_timestamp
protected
int|null
$storage_timestamp
$type
protected
static string
$type
$_authors
private
array<int, UserInterface>
$_authors
$_content_meta
private
array<string|int, mixed>|null
$_content_meta
$_forms
private
array<string|int, mixed>|null
$_forms
$_initialized
private
bool
$_initialized
= false
$_key
private
string
$_key
$_languages
private
array<string|int, mixed>|null
$_languages
$_metadata
private
array<string|int, mixed>|null
$_metadata
$_parentCache
private
PageInterface|null
$_parentCache
$_path
private
string|null
$_path
$_permissionsCache
private
array<string|int, mixed>|null
$_permissionsCache
$_route
private
string|null
$_route
$_translations
private
array<string|int, PageInterface>
$_translations
= []
Methods
__clone()
Clone page.
public
__clone() : mixed
Attributes
- #[ReturnTypeWillChange]
__construct()
Construct a new Flex Object instance.
public
__construct(array<string|int, mixed> $elements, mixed $key, FlexDirectory $directory[, bool $validate = false ]) : mixed
Parameters
- $elements : array<string|int, mixed>
-
Array of object properties.
- $key : mixed
-
Identifier key for the new object.
- $directory : FlexDirectory
-
Flex Directory the object belongs into.
- $validate : bool = false
-
True if the object should be validated against blueprint.
Tags
__debugInfo()
public
__debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>__get()
Returns the value at specified offset.
public
__get(mixed $offset) : mixed
Parameters
- $offset : mixed
-
The offset to retrieve.
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Can return all value types.
__isset()
Checks whether or not an offset exists.
public
__isset(mixed $offset) : bool
Parameters
- $offset : mixed
-
An offset to check for.
Attributes
- #[ReturnTypeWillChange]
Return values
bool —Returns TRUE on success or FALSE on failure.
__serialize()
public
final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__set()
Assigns a value to the specified offset.
public
__set(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
-
The offset to assign the value to.
- $value : mixed
-
The value to set.
Attributes
- #[ReturnTypeWillChange]
__toString()
Returns a string representation of this object.
public
__toString() : string
Attributes
- #[ReturnTypeWillChange]
Return values
string__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
__unset()
Magic method to unset the attribute
public
__unset(mixed $offset) : void
Parameters
- $offset : mixed
-
The name value to unset
Attributes
- #[ReturnTypeWillChange]
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, string $value) : void
Parameters
- $name : string
- $value : string
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([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
stringblueprints()
Alias of getBlueprint()
public
blueprints() : Blueprint
Admin compatibility
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
stringcheck()
public
check([UserInterface|null $user = null ]) : void
Parameters
- $user : UserInterface|null = null
checkMediaFilename()
public
checkMediaFilename(string $filename) : void
Use Media class that implements MediaUploadInterface instead.
Parameters
- $filename : string
children()
Returns children of this page.
public
children() : FlexIndexInterface|PageCollectionInterface|Collection
Return values
FlexIndexInterface|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()
public
content([mixed $var = null ]) : string
Parameters
- $var : mixed = null
Tags
Return values
stringcontentMeta()
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
$thiscreate()
Create new object into the storage.
public
create([string $key = null ]) : static
Parameters
- $key : string = null
-
Optional new key. If key isn't given, random key will be associated to the object.
Tags
Return values
staticcreateCopy()
public
createCopy([string|null $key = null ]) : FlexObjectInterface
Parameters
- $key : string|null = null
Return values
FlexObjectInterfacecreateFromStorage()
public
static createFromStorage(array<string|int, mixed> $elements, array<string|int, mixed> $storage, FlexDirectory $directory[, bool $validate = false ]) : static
Parameters
- $elements : array<string|int, mixed>
- $storage : array<string|int, mixed>
- $directory : FlexDirectory
- $validate : bool = false
Return values
staticcurrentPosition()
Returns the item in the current position.
public
currentPosition() : int|null
Return values
int|null —the index of the current page.
date()
public
date([mixed $var = null ]) : int
Parameters
- $var : mixed = null
Tags
Return values
intdateformat()
public
dateformat([mixed $var = null ]) : string|null
Parameters
- $var : mixed = null
Tags
Return values
string|nulldebugger()
Returns the state of the debugger override setting for this page
public
debugger() : bool
Return values
booldefNestedProperty()
public
defNestedProperty(string $property, mixed $default[, string|null $separator = null ]) : $this
Parameters
- $property : string
-
Object property to be updated.
- $default : mixed
-
Default value.
- $separator : string|null = null
-
Separator, defaults to '.'
Tags
Return values
$thisdefProperty()
public
defProperty(string $property, mixed $default) : $this
Parameters
- $property : string
-
Object property to be defined.
- $default : mixed
-
Default value.
Return values
$thisdelete()
Delete object from the storage.
public
delete() : static
Return values
staticeTag()
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 true if the object exists in the storage.
public
exists() : bool
Tags
Return values
bool —Returns true if the object exists, false otherwise.
expires()
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
filterBy()
Filter page (true/false) by given filters.
public
filterBy(array<string|int, mixed> $filters[, bool $recursive = false ]) : bool
- search: string
- extension: string
- module: bool
- visible: bool
- routable: bool
- published: bool
- page: bool
- translated: bool
Parameters
- $filters : array<string|int, mixed>
- $recursive : bool = false
Return values
boolfind()
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
findTranslation()
public
findTranslation([string|null $languageCode = null ][, bool|null $fallback = null ]) : string|null
Parameters
- $languageCode : string|null = null
- $fallback : bool|null = null
Return values
string|nullfolder()
Get/set the folder.
public
folder([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
Optional path, including numeric prefix.
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
stringfull_order()
public
full_order() : string
Return values
stringgetAction()
Gets the action.
public
getAction() : string|null
Return values
string|null —The Action string.
getAllLanguages()
public
getAllLanguages([bool $includeDefault = false ]) : array<string|int, mixed>
Parameters
- $includeDefault : bool = false
-
If set to true, return separate entries for '' and 'en' (default) language.
Return values
array<string|int, mixed>getAuthors()
Get list of all author objects.
public
getAuthors() : array<int, UserInterface>
Return values
array<int, UserInterface>getBlueprint()
Returns the blueprint of the object.
public
getBlueprint([string $name = '' ]) : Blueprint
Parameters
- $name : string = ''
-
Name of the Blueprint form. Used to create customized forms for different use cases.
Tags
Return values
Blueprint —Returns a Blueprint.
getCache()
public
getCache([string|null $namespace = null ]) : CacheInterface
Parameters
- $namespace : string|null = null
Return values
CacheInterfacegetCacheChecksum()
Get cache checksum for the object / collection.
public
getCacheChecksum() : string
Tags
Return values
string —Returns cache checksum.
getCachedMethods()
public
static getCachedMethods() : array<string|int, mixed>
Return values
array<string|int, mixed>getCacheKey()
Get a cache key which is used for caching the object / collection.
public
getCacheKey() : string
Tags
Return values
string —Returns cache key.
getChanges()
Get any changes from the object.
public
getChanges() : array<string|int, mixed>
Return values
array<string|int, mixed>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>|nullgetCreated_Timestamp()
public
getCreated_Timestamp() : int
Return values
intgetDefaultValue()
Returns default value suitable to be used in a form for the given property.
public
getDefaultValue(string $name[, string $separator = null ]) : mixed|null
Parameters
- $name : string
-
Property name.
- $separator : string = null
-
Optional nested property separator.
Tags
Return values
mixed|null —Returns default value of the field, null if there is no default value.
getDefaultValues()
Returns default values suitable to be used in a form for the given property.
public
getDefaultValues() : array<string|int, mixed>
Return values
array<string|int, mixed>getDiff()
Get diff array from the object.
public
getDiff() : array<string|int, mixed>
Return values
array<string|int, mixed>getFieldSettings()
public
getFieldSettings(string $field) : array<string|int, mixed>|null
Parameters
- $field : string
Return values
array<string|int, mixed>|nullgetFlexDirectory()
public
abstract getFlexDirectory() : FlexDirectory
Return values
FlexDirectorygetFlexFeatures()
Get full list of features the object / collection implements.
public
getFlexFeatures() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getFlexKey()
Get a unique key for the object.
public
getFlexKey() : string
Tags
Return values
string —Returns Flex Key of the object.
getFlexType()
Get Flex Type of the object / collection.
public
getFlexType() : string
Tags
Return values
string —Returns Flex Type of the collection.
getForm()
Returns a form instance for the object.
public
getForm([string $name = '' ][, array<string|int, mixed> $options = null ]) : FlexFormInterface
Parameters
- $name : string = ''
-
Name of the form. Can be used to create customized forms for different use cases.
- $options : array<string|int, mixed> = null
-
Options can be used to further customize the form.
Tags
Return values
FlexFormInterface —Returns a Form.
getForms()
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>getFormValue()
Returns raw value suitable to be used in a form for the given property.
public
getFormValue(string $name[, mixed $default = null ][, string $separator = null ]) : mixed
Parameters
- $name : string
-
Property name.
- $default : mixed = null
-
Default value.
- $separator : string = null
-
Optional nested property separator.
Tags
Return values
mixed —Returns value of the field.
getKey()
public
getKey() : string
Tags
Return values
stringgetLanguage()
public
getLanguage() : string
Return values
stringgetLanguages()
Returns all translated languages.
public
getLanguages([bool $includeDefault = false ]) : array<string|int, mixed>
Parameters
- $includeDefault : bool = false
-
If set to true, return separate entries for '' and 'en' (default) language.
Return values
array<string|int, mixed>getLevelListing()
public
getLevelListing(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
Return values
array<string|int, mixed>getMasterKey()
Get master storage key.
public
getMasterKey() : string
Tags
Return values
stringgetMedia()
public
getMedia() : MediaCollectionInterface
Return values
MediaCollectionInterfacegetMediaField()
public
getMediaField(string $field) : MediaCollectionInterface|null
Parameters
- $field : string
Return values
MediaCollectionInterface|nullgetMediaFolder()
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>getMetaData()
Get index data associated to the object.
public
getMetaData() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Returns metadata of the object.
getNestedProperty()
public
getNestedProperty(string $property[, mixed|null $default = null ][, string|null $separator = null ]) : mixed
Parameters
- $property : string
-
Object property to be fetched.
- $default : mixed|null = null
-
Default value if property has not been set.
- $separator : string|null = null
-
Separator, defaults to '.'
Return values
mixed —Property value.
getOriginal()
Gets the Page Unmodified (original) version of the page.
public
getOriginal() : FlexPageObject|null
Assumes that object has been cloned before modifying it.
Return values
FlexPageObject|null —The original version of the page.
getOriginalData()
Get original data before update
public
getOriginalData() : array<string|int, mixed>
Return values
array<string|int, mixed>getPermissions()
public
getPermissions([bool $inherit = false ]) : array<string|int, mixed>
Parameters
- $inherit : bool = false
Return values
array<string|int, mixed>getProperty()
public
getProperty(string $property[, mixed $default = null ]) : mixed
Parameters
- $property : string
- $default : mixed = null
getPublish_Timestamp()
public
getPublish_Timestamp() : int
Return values
intgetRawContent()
public
getRawContent() : string
Tags
Return values
stringgetRoute()
public
getRoute([string|array<string|int, mixed> $query = [] ]) : Route|null
Parameters
- $query : string|array<string|int, mixed> = []
Return values
Route|nullgetStorageFolder()
public
getStorageFolder() : string|null
Return values
string|nullgetStorageKey()
public
abstract getStorageKey() : string
Return values
stringgetTimestamp()
Get last updated timestamp for the object / collection.
public
getTimestamp() : int
Tags
Return values
int —Returns Unix timestamp.
getTranslation()
public
getTranslation([string|null $languageCode = null ][, bool|null $fallback = null ]) : FlexObjectInterface|PageInterface|null
Parameters
- $languageCode : string|null = null
- $fallback : bool|null = null
Return values
FlexObjectInterface|PageInterface|nullgetType()
public
getType([bool $prefix = false ]) : string
Use ->getFlexType() instead.
Parameters
- $prefix : bool = false
Return values
stringgetUnpublish_Timestamp()
public
getUnpublish_Timestamp() : int|null
Return values
int|nullgetUpdated_Timestamp()
public
getUpdated_Timestamp() : int
Return values
inthasAuthor()
Returns true if object has the named author.
public
hasAuthor(string $username) : bool
Parameters
- $username : string
Return values
boolhasFlexFeature()
Test whether the feature is implemented in the object / collection.
public
hasFlexFeature(string $name) : bool
Parameters
- $name : string
Tags
Return values
boolhasKey()
public
hasKey() : bool
Return values
boolhasNestedProperty()
public
hasNestedProperty(string $property[, string|null $separator = null ]) : bool
Parameters
- $property : string
-
Object property name.
- $separator : string|null = null
-
Separator, defaults to '.'
Return values
bool —True if property has been defined (can be null).
hasProperty()
public
hasProperty(string $property) : bool
Parameters
- $property : string
-
Object property name.
Return values
bool —True if property has been defined (can be null).
hasTranslation()
public
hasTranslation([string|null $languageCode = null ][, bool|null $fallback = null ]) : bool
Parameters
- $languageCode : string|null = null
- $fallback : bool|null = null
Return values
boolheader()
public
header([mixed $var = null ]) : Header
Parameters
- $var : mixed = null
Tags
Return values
Headerhome()
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()
public
id([mixed $var = null ]) : string
Parameters
- $var : mixed = null
Tags
Return values
stringinherited()
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
$thisinitialize()
public
initialize() : void
isAuthorized()
Check if user is authorized for the action.
public
isAuthorized(string $action[, string|null $scope = null ][, UserInterface|null $user = null ]) : bool|null
Note: There are two deny values: denied (false), not set (null). This allows chaining multiple rules together when the previous rules were not matched.
To override the default behavior, please use isAuthorizedOverride().
Parameters
- $action : string
- $scope : string|null = null
- $user : UserInterface|null = null
Tags
Return values
bool|nullisDir()
public
isDir() : bool
Tags
Return values
boolisFirst()
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()
public
isModule() : bool
Return values
boolisOrdered()
public
isOrdered([bool $test = true ]) : bool
Parameters
- $test : bool = true
Return values
boolisPage()
public
isPage([bool $bool = true ]) : bool
Parameters
- $bool : bool = true
Tags
Return values
boolisParentAuthorized()
public
isParentAuthorized(string $action[, string|null $scope = null ][, UserInterface|null $user = null ][, bool $isAuthor = false ]) : bool|null
Parameters
- $action : string
- $scope : string|null = null
- $user : UserInterface|null = null
- $isAuthor : bool = false
Return values
bool|nullisPublished()
public
isPublished([bool $test = true ]) : bool
Parameters
- $test : bool = true
Return values
boolisRoutable()
public
isRoutable([bool $test = true ]) : bool
Parameters
- $test : bool = true
Return values
boolisVisible()
public
isVisible([bool $test = true ]) : bool
Parameters
- $test : bool = true
Return values
booljsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Attributes
- #[ReturnTypeWillChange]
Return values
array<string|int, mixed>language()
Get page language
public
language([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
Return values
string|nulllastModified()
public
lastModified([mixed $var = null ]) : bool
Parameters
- $var : mixed = null
Tags
Return values
boollink()
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()
public
media([mixed $var = null ]) : Media
Parameters
- $var : mixed = null
Tags
Return values
Mediamenu()
public
menu([mixed $var = null ]) : string
Parameters
- $var : mixed = null
Tags
Return values
stringmetadata()
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()
public
modified([mixed $var = null ]) : int
Parameters
- $var : mixed = null
Tags
Return values
intmodifyHeader()
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
offsetExists()
Whether or not an offset exists.
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
-
An offset to check for.
Attributes
- #[ReturnTypeWillChange]
Return values
bool —Returns TRUE on success or FALSE on failure.
offsetGet()
Returns the value at specified offset.
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
-
The offset to retrieve.
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Can return all value types.
offsetSet()
Assigns a value to the specified offset.
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
-
The offset to assign the value to.
- $value : mixed
-
The value to set.
Attributes
- #[ReturnTypeWillChange]
offsetUnset()
Unsets an offset.
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
-
The offset to unset.
Attributes
- #[ReturnTypeWillChange]
order()
public
order([mixed $var = null ]) : mixed
Parameters
- $var : mixed = null
Tags
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>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.
parentStorageKey()
Get/set the folder.
public
parentStorageKey([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
-
Optional path, including numeric prefix.
Return values
string|nullpath()
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.
prepareStorage()
Prepare object for saving into the storage.
public
prepareStorage() : array<string|int, mixed>
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
process()
public
process([mixed $var = null ]) : array<string|int, mixed>
Parameters
- $var : mixed = null
Tags
Return values
array<string|int, mixed>publishDate()
public
publishDate([mixed $var = null ]) : int|null
Parameters
- $var : mixed = null
Tags
Return values
int|nullpublished()
public
published([mixed $var = null ]) : bool
Parameters
- $var : mixed = null
Tags
Return values
boolraw()
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()
public
rawMarkdown([mixed $var = null ]) : string
Parameters
- $var : mixed = null
Tags
Return values
stringrawRoute()
Gets and Sets the page raw route
public
rawRoute([string|null $var = null ]) : string|null
Parameters
- $var : string|null = null
Return values
string|nullredirect()
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|nullrefresh()
Refresh object from the storage.
public
refresh([bool $keepMissing = false ]) : bool
Parameters
- $keepMissing : bool = false
Return values
bool —True if the object was refreshed
relativePagePath()
Returns the clean path to the page file
public
relativePagePath() : string|null
Needed in admin for Page Media.
Return values
string|nullrender()
Renders the object.
public
render([string $layout = null ][, array<string|int, mixed> $context = [] ]) : ContentBlockInterface|HtmlBlock
Parameters
- $layout : string = null
-
Layout to be used.
- $context : array<string|int, mixed> = []
-
Extra context given to the renderer.
Tags
Return values
ContentBlockInterface|HtmlBlock —Returns HtmlBlock containing the rendered output.
resetMetadata()
Reset the metadata and pull from header again
public
resetMetadata() : void
root()
Returns whether or not this page is the root node of the pages tree.
public
root([bool|null $var = null ]) : bool
Parameters
- $var : bool|null = null
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 $var = null ]) : string|null
Parameters
- $var : string = 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 ]) : string|null
Parameters
- $var : string|null = null
Return values
string|nullsave()
Save object into the storage.
public
save([array<string|int, mixed>|bool $reorder = true ]) : static
Parameters
- $reorder : array<string|int, mixed>|bool = true
Return values
staticsearch()
Search a string from the object, returns weight between 0 and 1.
public
search(string $search[, mixed $properties = null ][, array<string|int, mixed> $options = null ]) : float
Parameters
- $search : string
-
Search string.
- $properties : mixed = null
-
Properties to search for, defaults to configured properties.
- $options : array<string|int, mixed> = null
-
Search options, defaults to configured options.
Tags
Return values
float —Returns a weight between 0 and 1.
searchNestedProperty()
public
searchNestedProperty(string $property, string $search[, array<string|int, mixed>|null $options = null ]) : float
Parameters
- $property : string
- $search : string
- $options : array<string|int, mixed>|null = null
Return values
floatsearchProperty()
public
searchProperty(string $property, string $search[, array<string|int, mixed>|null $options = null ]) : float
Parameters
- $property : string
- $search : string
- $options : array<string|int, mixed>|null = null
Return values
floatsetContentMeta()
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>setFlexDirectory()
public
setFlexDirectory(FlexDirectory $directory) : void
Parameters
- $directory : FlexDirectory
setNestedProperty()
public
setNestedProperty(string $property, mixed $value[, string|null $separator = null ]) : $this
Parameters
- $property : string
- $value : mixed
- $separator : string|null = null
Return values
$thissetProperty()
public
setProperty(string $property, mixed $value) : $this
Parameters
- $property : string
- $value : mixed
Return values
$thissetRawContent()
public
setRawContent(mixed $content) : void
Parameters
- $content : mixed
Tags
setStorageKey()
public
setStorageKey([string|null $key = null ]) : $this
Parameters
- $key : string|null = null
Return values
$thissetSummary()
public
setSummary(mixed $summary) : void
Parameters
- $summary : mixed
Tags
setTimestamp()
public
setTimestamp([int $timestamp = null ]) : $this
Parameters
- $timestamp : int = null
Return values
$thisshouldProcess()
public
shouldProcess(mixed $process) : bool
Parameters
- $process : mixed
Tags
Return values
boolslug()
public
slug([mixed $var = null ]) : mixed
Parameters
- $var : mixed = null
Tags
ssl()
public
ssl([bool|null $var = null ]) : bool|null
Parameters
- $var : bool|null = null
Return values
bool|nullstoreOriginal()
Store the Page Unmodified (original) version of the page.
public
storeOriginal() : void
Can be called multiple times, only the first call matters.
summary()
public
summary([mixed $size = null ][, mixed $textOnly = false ]) : string
Parameters
- $size : mixed = null
- $textOnly : mixed = false
Tags
Return values
stringtaxonomy()
public
taxonomy([mixed $var = null ]) : array<string|int, mixed>
Parameters
- $var : mixed = null
Tags
Return values
array<string|int, mixed>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()
public
title([mixed $var = null ]) : string
Parameters
- $var : mixed = null
Tags
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
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
stringtranslated()
public
translated() : bool
Return values
booltranslatedLanguages()
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
triggerEvent()
public
triggerEvent(string $name[, object|null $event = null ]) : $this
Parameters
- $name : string
- $event : object|null = null
Return values
$thisunpublishDate()
public
unpublishDate([mixed $var = null ]) : int|null
Parameters
- $var : mixed = null
Tags
Return values
int|nullunsetNestedProperty()
public
unsetNestedProperty(string $property[, string|null $separator = null ]) : $this
Parameters
- $property : string
- $separator : string|null = null
Return values
$thisunsetProperty()
public
unsetProperty(string $property) : $this
Parameters
- $property : string
-
Object property to be unset.
Return values
$thisunsetRouteSlug()
Helper method to clear the route out so it regenerates next time you use it
public
unsetRouteSlug() : void
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
update()
Updates object in the memory.
public
update(array<string|int, mixed> $data[, array<string|int, mixed> $files = [] ]) : static
Parameters
- $data : array<string|int, mixed>
-
Data containing updated properties with their values. To unset a value, use
null. - $files : array<string|int, mixed> = []
-
List of uploaded files to be saved within the object.
Tags
Return values
staticurl()
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
- $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()
public
abstract value(mixed $name[, mixed $default = null ][, mixed $separator = null ]) : mixed
Parameters
- $name : mixed
- $default : mixed = null
- $separator : mixed = null
Tags
visible()
public
visible([mixed $var = null ]) : bool
Parameters
- $var : mixed = null
Tags
Return values
booladdUpdatedMedia()
protected
addUpdatedMedia(MediaCollectionInterface $media) : void
Parameters
- $media : MediaCollectionInterface
buildMediaList()
protected
buildMediaList(string|null $field) : array<string|int, mixed>
Parameters
- $field : string|null
Return values
array<string|int, mixed>buildMediaObject()
protected
buildMediaObject(string|null $field, string $filename[, MediaObjectInterface|null $image = null ]) : MediaObject|UploadedMediaObject
Parameters
- $field : string|null
- $filename : string
- $image : MediaObjectInterface|null = null
Return values
MediaObject|UploadedMediaObjectcreateFormObject()
This methods allows you to override form objects in child classes.
protected
createFormObject(string $name[, array<string|int, mixed>|null $options = null ]) : FlexFormInterface
Parameters
- $name : string
-
Form name
- $options : array<string|int, mixed>|null = null
-
Form optiosn
Return values
FlexFormInterfacecreateMedium()
protected
createMedium(string $uri) : Medium|null
Parameters
- $uri : string
Return values
Medium|nulldoGetBlueprint()
protected
doGetBlueprint([string $name = '' ]) : Blueprint
Parameters
- $name : string = ''
Return values
BlueprintdoGetProperty()
protected
& doGetProperty(string $property[, mixed $default = null ][, bool $doCreate = false ]) : mixed
Parameters
- $property : string
-
Object property to be fetched.
- $default : mixed = null
-
Default value if property has not been set.
- $doCreate : bool = false
Return values
mixed —Property value.
doHasProperty()
protected
doHasProperty(string $property) : bool
Parameters
- $property : string
-
Object property name.
Return values
bool —True if property has been defined (can be null).
doSerialize()
protected
doSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>doSetProperty()
protected
doSetProperty(string $property, mixed $value) : void
Parameters
- $property : string
-
Object property to be updated.
- $value : mixed
-
New value.
doUnserialize()
protected
doUnserialize(array<string|int, mixed> $serialized[, FlexDirectory|null $directory = null ]) : void
Parameters
- $serialized : array<string|int, mixed>
- $directory : FlexDirectory|null = null
doUnsetProperty()
protected
doUnsetProperty(string $property) : void
Parameters
- $property : string
-
Object property to be unset.
filterElements()
Filter data coming to constructor or $this->update() request.
protected
filterElements(array<string|int, mixed> &$elements[, bool $extended = false ]) : void
Parameters
- $elements : array<string|int, mixed>
- $extended : bool = false
freeMedia()
protected
freeMedia() : void
getActiveUser()
protected
getActiveUser() : UserInterface|null
Return values
UserInterface|nullgetAuthorizeAction()
protected
getAuthorizeAction(string $action) : string
Parameters
- $action : string
Return values
stringgetAuthorizeRule()
protected
getAuthorizeRule(string $scope, string $action) : string
Parameters
- $scope : string
- $action : string
Return values
stringgetAuthorizeScope()
protected
getAuthorizeScope() : string
Return values
stringgetCollectionByProperty()
protected
getCollectionByProperty(string $type, string $property) : FlexCollectionInterface<string|int, FlexObjectInterface>
Parameters
- $type : string
- $property : string
Return values
FlexCollectionInterface<string|int, FlexObjectInterface>getContainer()
protected
getContainer() : Grav
Return values
GravgetElement()
protected
getElement(string $property[, mixed|null $default = null ]) : mixed|null
Parameters
- $property : string
- $default : mixed|null = null
Return values
mixed|nullgetElements()
protected
getElements() : array<string|int, mixed>
Return values
array<string|int, mixed>getFallbackLanguages()
protected
getFallbackLanguages([string|null $languageCode = null ][, bool|null $fallback = null ]) : array<string|int, mixed>
Parameters
- $languageCode : string|null = null
- $fallback : bool|null = null
Return values
array<string|int, mixed>getFieldDateTime()
protected
getFieldDateTime(string $field) : DateTime|null
Parameters
- $field : string
Return values
DateTime|nullgetFieldTimestamp()
protected
getFieldTimestamp(string $field) : int|null
Parameters
- $field : string
Return values
int|nullgetFlexContainer()
protected
getFlexContainer() : Flex
Return values
FlexgetInheritedParams()
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>getLanguageTemplates()
protected
getLanguageTemplates() : array<string|int, mixed>
Return values
array<string|int, mixed>getMediaCache()
protected
getMediaCache() : CacheInterface
Return values
CacheInterfacegetMediaFields()
protected
getMediaFields() : array<string|int, mixed>
Return values
array<string|int, mixed>getRelatedDirectory()
protected
getRelatedDirectory(string $type) : FlexDirectory
Parameters
- $type : string
Tags
Return values
FlexDirectorygetStorage()
protected
getStorage() : array<string|int, mixed>
Use ->getMetaData() instead.
Return values
array<string|int, mixed>getTemplate()
protected
getTemplate(string $layout) : Template|TemplateWrapper
Moved to \Grav\Common\Flex\Traits\GravTrait
Parameters
- $layout : string
Tags
Return values
Template|TemplateWrappergetTemplateConfig()
protected
getTemplateConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>getTemplatePaths()
protected
getTemplatePaths(string $layout) : array<string|int, mixed>
Parameters
- $layout : string
Return values
array<string|int, mixed>getTypePrefix()
protected
getTypePrefix() : string
Return values
stringgetUpdatedMedia()
protected
getUpdatedMedia() : array<string, UploadedFileInterface|array<string|int, mixed>|null>
Return values
array<string, UploadedFileInterface|array<string|int, mixed>|null>isAdminSite()
protected
isAdminSite() : bool
Return values
boolisAuthorizedAction()
Check if user is authorized for the action.
protected
isAuthorizedAction(UserInterface $user, string $action, string $scope, bool $isMe) : bool|null
Parameters
- $user : UserInterface
- $action : string
- $scope : string
- $isMe : bool
Return values
bool|nullisAuthorizedByGroup()
Group authorization works as follows:
protected
isAuthorizedByGroup(UserInterface $user, string $action, string $scope, bool $isMe, bool $isAuthor) : bool|null
- if any of the groups deny access, return false
- else if any of the groups allow access, return true
- else return null
Parameters
- $user : UserInterface
- $action : string
- $scope : string
- $isMe : bool
- $isAuthor : bool
Return values
bool|nullisAuthorizedOverride()
protected
isAuthorizedOverride(UserInterface $user, string $action, string $scope, bool $isMe) : bool|null
Parameters
- $user : UserInterface
- $action : string
- $scope : string
- $isMe : bool
Return values
bool|nullisAuthorizedSuperAdmin()
protected
isAuthorizedSuperAdmin(UserInterface $user) : bool|null
Not needed for Flex Users.
Parameters
- $user : UserInterface
Return values
bool|nullisMoved()
protected
isMoved() : bool
Return values
boolloadAuthors()
protected
loadAuthors(iterable<string|int, mixed> $authors) : array<int, UserInterface>
Parameters
- $authors : iterable<string|int, mixed>
Return values
array<int, UserInterface>loadHeaderProperty()
Common logic to load header properties.
protected
loadHeaderProperty(string $property, mixed $var, callable $filter) : mixed|null
Parameters
- $property : string
- $var : mixed
- $filter : callable
Return values
mixed|nullloadPermissions()
protected
loadPermissions([array<string|int, mixed> $parent = [] ]) : array<string|int, mixed>
Parameters
- $parent : array<string|int, mixed> = []
Return values
array<string|int, mixed>loadProperty()
Common logic to load header properties.
protected
loadProperty(string $property, mixed $var, callable $filter) : mixed|null
Parameters
- $property : string
- $var : mixed
- $filter : callable
Return values
mixed|nullmarkAsCopy()
protected
markAsCopy() : void
normalizeForm()
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>|nulloffsetLoad_header()
protected
offsetLoad_header(Header|stdClass|array<string|int, mixed>|null $value) : Header
Parameters
- $value : Header|stdClass|array<string|int, mixed>|null
Return values
HeaderoffsetLoad_media()
protected
offsetLoad_media() : MediaCollectionInterface
Return values
MediaCollectionInterfaceoffsetPrepare_header()
protected
offsetPrepare_header(Header|stdClass|array<string|int, mixed>|null $value) : Header
Parameters
- $value : Header|stdClass|array<string|int, mixed>|null
Return values
HeaderoffsetSerialize_header()
protected
offsetSerialize_header(Header|null $value) : array<string|int, mixed>
Parameters
- $value : Header|null
Return values
array<string|int, mixed>offsetSerialize_media()
protected
offsetSerialize_media() : null
Return values
nullonAfterSave()
protected
onAfterSave(array<string|int, mixed> $variables) : void
Parameters
- $variables : array<string|int, mixed>
onBeforeSave()
protected
onBeforeSave(array<string|int, mixed> $variables) : array<string|int, mixed>
Parameters
- $variables : array<string|int, mixed>
Return values
array<string|int, mixed>onSave()
protected
onSave(array<string|int, mixed> $variables) : array<string|int, mixed>
Parameters
- $variables : array<string|int, mixed>
Return values
array<string|int, mixed>pageContentValue()
protected
pageContentValue(string $name[, mixed|null $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed|null = null
parseFileProperty()
protected
parseFileProperty(array<string|int, mixed>|mixed $value[, array<string|int, mixed> $settings = [] ]) : array<string|int, mixed>|mixed
Parameters
- $value : array<string|int, mixed>|mixed
- $settings : array<string|int, mixed> = []
Return values
array<string|int, mixed>|mixedprocessContent()
Gets and Sets the content based on content portion of the .md file
protected
processContent(string $content) : string
Parameters
- $content : string
Tags
Return values
stringprocessMarkdown()
Process the Markdown content.
protected
processMarkdown(string $content[, array<string|int, mixed> $options = [] ]) : string
Uses Parsedown or Parsedown Extra depending on configuration.
Parameters
- $content : string
- $options : array<string|int, mixed> = []
Tags
Return values
stringprocessSummary()
protected
processSummary([int|null $size = null ][, bool $textOnly = false ]) : string
Parameters
- $size : int|null = null
- $textOnly : bool = false
Return values
stringprocessTwig()
Process the Twig page content.
protected
processTwig(string $content) : string
Parameters
- $content : string
Return values
stringreorderSiblings()
protected
reorderSiblings(array<string|int, mixed> $ordering) : PageCollection|null
Parameters
- $ordering : array<string|int, mixed>
Tags
Return values
PageCollection|nullresetBlueprints()
Method to reset blueprints if the type changes.
protected
resetBlueprints() : void
Tags
routeInternal()
protected
routeInternal() : string|null
Return values
string|nullsaveUpdatedMedia()
protected
saveUpdatedMedia() : void
searchValue()
protected
searchValue(string $name, mixed $value, string $search[, array<string|int, mixed>|null $options = null ]) : float
Parameters
- $name : string
- $value : mixed
- $search : string
- $options : array<string|int, mixed>|null = null
Return values
floatsetKey()
protected
setKey(string $key) : $this
Parameters
- $key : string
Return values
$thissetMetaData()
protected
setMetaData(array<string|int, mixed> $meta) : void
Parameters
- $meta : array<string|int, mixed>
setStorage()
protected
setStorage(array<string|int, mixed> $storage) : void
Use ->setMetaData() instead.
Parameters
- $storage : array<string|int, mixed>
setUpdatedMedia()
protected
setUpdatedMedia(array<string|int, mixed> $files) : void
Parameters
- $files : array<string|int, mixed>