PHP Класс RainLab\Pages\Classes\Page

Автор: Alexey Bobkov, Samuel Georges
Наследование: extends Cms\Classes\Content
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$attributeNames The array of custom attribute names.
$implement
$parentFileName Contains the page parent file name. This property is used by the page editor internally.
$rules The rules to be applied to the data.
$translatable Attributes that support translation, if available.
$translatableModel Translation model used for translation, if available.

Защищенные свойства (Protected)

Свойство Тип Описание
$childrenCache
$dirName The container name associated with the model, eg: pages.
$fillable Properties that can be set with fill()
$menuTreeCache
$parentCache
$processedBlockMarkupCache
$processedMarkupCache
$purgeable List of attribute names which are not considered "settings".
$wrapCode Wrap code section in PHP tags.

Открытые методы

Метод Описание
__construct ( array $attributes = [] ) Creates an instance of the object and associates it with a CMS theme.
afterCreate ( ) Triggered after a new object is saved.
beforeCreate ( ) Triggered before a new object is saved.
beforeValidate ( ) Validates the object properties.
buildMenuTree ( Cms\Classes\Theme $theme ) : array Builds and caches a menu item tree.
clearMenuCache ( Cms\Classes\Theme $theme ) Clears the menu item cache
delete ( ) : array Deletes the object from the disk.
fill ( array $attributes ) Sets the object attributes.
getChildren ( ) : array Returns all the child pages that belong to this one.
getLayoutObject ( ) : Cms\Classes\Layout Looks up the Layout Cms object for this page.
getLayoutOptions ( ) : array Returns a list of layouts available in the theme.
getMenuTypeInfo ( string $type ) : array Handler for the pages.menuitem.getTypeInfo event.
getParent ( ) : mixed Returns the parent page that belongs to this one, or null.
getPlaceholdersAttribute ( ) : array Parses the page placeholder {% put %} tags and extracts the placeholder values.
getProcessedMarkup ( )
getProcessedPlaceholderMarkup ( $placeholderName, $placeholderContents )
getRichEditorTypeInfo ( string $type ) : array Handler for the backend.richeditor.getTypeInfo event.
getTwigContent ( ) Returns the Twig content string
initCmsComponents ( $cmsController ) Initializes CMS components associated with the page.
listLayoutPlaceholders ( ) : array Returns information about placeholders defined in the page layout.
listLayoutSyntaxFields ( )
resolveMenuItem ( RainLab\Pages\Classes\MenuItem $item, string $url, Cms\Classes\Theme $theme ) : mixed Handler for the pages.menuitem.resolveItem event.
setPlaceholdersAttribute ( array $value ) : void Takes an array of placeholder data (key: code, value: content) and renders it as a single string of Twig markup against the "code" attribute.
url ( $name ) : string Helper that makes a URL for a static page in the active theme.

Защищенные методы

Метод Описание
appendToMeta ( ) Adds this page to the meta index.
flattenTwigNode ( $node ) : array Recursively flattens a twig node and children
generateFilenameFromCode ( ) * Generate a file name based on the URL
getMenuCacheKey ( $theme ) Returns a cache key for this record.
getValidationAttributes ( ) : array Returns the attributes used for validation.
listStaticPageMenuOptions ( ) : array Returns a list of options for the Reference drop-down menu in the menu item configuration form, when the Static Page item type is selected.
removeFromMeta ( ) Removes this page to the meta index.

Описание методов

__construct() публичный Метод

Creates an instance of the object and associates it with a CMS theme.
public __construct ( array $attributes = [] )
$attributes array

afterCreate() публичный Метод

Triggered after a new object is saved.
public afterCreate ( )

appendToMeta() защищенный Метод

Adds this page to the meta index.
protected appendToMeta ( )

beforeCreate() публичный Метод

Triggered before a new object is saved.
public beforeCreate ( )

beforeValidate() публичный Метод

Throws a ValidationException in case of an error.
public beforeValidate ( )

buildMenuTree() публичный статический Метод

This method is used internally for menu items and breadcrumbs.
public static buildMenuTree ( Cms\Classes\Theme $theme ) : array
$theme Cms\Classes\Theme Specifies the current theme.
Результат array Returns an array containing the page information

clearMenuCache() публичный статический Метод

Clears the menu item cache
public static clearMenuCache ( Cms\Classes\Theme $theme )
$theme Cms\Classes\Theme Specifies the current theme.

delete() публичный Метод

Recursively deletes subpages. Returns a list of file names of deleted pages.
public delete ( ) : array
Результат array

fill() публичный Метод

Sets the object attributes.
public fill ( array $attributes )
$attributes array A list of attributes to set.

flattenTwigNode() защищенный Метод

Recursively flattens a twig node and children
protected flattenTwigNode ( $node ) : array
$node
Результат array A flat array of twig nodes

generateFilenameFromCode() защищенный Метод

* Generate a file name based on the URL
protected generateFilenameFromCode ( )

getChildren() публичный Метод

Returns all the child pages that belong to this one.
public getChildren ( ) : array
Результат array

getLayoutObject() публичный Метод

Looks up the Layout Cms object for this page.
public getLayoutObject ( ) : Cms\Classes\Layout
Результат Cms\Classes\Layout

getLayoutOptions() публичный Метод

This method is used by the form widget.
public getLayoutOptions ( ) : array
Результат array Returns an array of strings.

getMenuCacheKey() защищенный статический Метод

Returns a cache key for this record.
protected static getMenuCacheKey ( $theme )

getMenuTypeInfo() публичный статический Метод

Returns a menu item type information. The type information is returned as array with the following elements: - references - a list of the item type reference options. The options are returned in the ["key"] => "title" format for options that don't have sub-options, and in the format ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional, required only if the menu item type requires references. - nesting - Boolean value indicating whether the item type supports nested items. Optional, false if omitted. - dynamicItems - Boolean value indicating whether the item type could generate new menu items. Optional, false if omitted. - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to resolve the item URL.
public static getMenuTypeInfo ( string $type ) : array
$type string Specifies the menu item type
Результат array Returns an array

getParent() публичный Метод

Returns the parent page that belongs to this one, or null.
public getParent ( ) : mixed
Результат mixed

getPlaceholdersAttribute() публичный Метод

Parses the page placeholder {% put %} tags and extracts the placeholder values.
public getPlaceholdersAttribute ( ) : array
Результат array Returns an associative array of the placeholder names and values.

getProcessedMarkup() публичный Метод

public getProcessedMarkup ( )

getProcessedPlaceholderMarkup() публичный Метод

public getProcessedPlaceholderMarkup ( $placeholderName, $placeholderContents )

getRichEditorTypeInfo() публичный статический Метод

Returns a menu item type information. The type information is returned as array
public static getRichEditorTypeInfo ( string $type ) : array
$type string Specifies the page link type
Результат array

getTwigContent() публичный Метод

Returns the Twig content string
public getTwigContent ( )

getValidationAttributes() защищенный Метод

Returns the attributes used for validation.
protected getValidationAttributes ( ) : array
Результат array

initCmsComponents() публичный Метод

Initializes CMS components associated with the page.
public initCmsComponents ( $cmsController )

listLayoutPlaceholders() публичный Метод

Returns information about placeholders defined in the page layout.
public listLayoutPlaceholders ( ) : array
Результат array Returns an associative array of the placeholder name and codes.

listLayoutSyntaxFields() публичный Метод

listStaticPageMenuOptions() защищенный статический Метод

Returns a list of options for the Reference drop-down menu in the menu item configuration form, when the Static Page item type is selected.
protected static listStaticPageMenuOptions ( ) : array
Результат array Returns an array

removeFromMeta() защищенный Метод

Removes this page to the meta index.
protected removeFromMeta ( )

resolveMenuItem() публичный статический Метод

Returns information about a menu item. The result is an array with the following keys: - url - the menu item URL. Not required for menu item types that return all available records. The URL should be returned relative to the website root and include the subdirectory, if any. Use the Cms::url() helper to generate the URLs. - isActive - determines whether the menu item is active. Not required for menu item types that return all available records. - items - an array of arrays with the same keys (url, isActive, items) + the title key. The items array should be added only if the $item's $nesting property value is TRUE.
public static resolveMenuItem ( RainLab\Pages\Classes\MenuItem $item, string $url, Cms\Classes\Theme $theme ) : mixed
$item RainLab\Pages\Classes\MenuItem Specifies the menu item.
$url string Specifies the current page URL, normalized, in lower case The URL is specified relative to the website root, it includes the subdirectory name, if any.
$theme Cms\Classes\Theme Specifies the current theme.
Результат mixed Returns an array. Returns null if the item cannot be resolved.

setPlaceholdersAttribute() публичный Метод

Takes an array of placeholder data (key: code, value: content) and renders it as a single string of Twig markup against the "code" attribute.
public setPlaceholdersAttribute ( array $value ) : void
$value array
Результат void

url() публичный статический Метод

Guide for the page reference: - chairs -> content/static-pages/chairs.htm
public static url ( $name ) : string
Результат string

Описание свойств

$attributeNames публичное свойство

The array of custom attribute names.
public $attributeNames

$childrenCache защищенное свойство

protected $childrenCache

$dirName защищенное свойство

The container name associated with the model, eg: pages.
protected $dirName

$fillable защищенное свойство

Properties that can be set with fill()
protected $fillable

$implement публичное свойство

public $implement

$menuTreeCache защищенное статическое свойство

protected static $menuTreeCache

$parentCache защищенное свойство

protected $parentCache

$parentFileName публичное свойство

Contains the page parent file name. This property is used by the page editor internally.
public $parentFileName

$processedBlockMarkupCache защищенное свойство

protected $processedBlockMarkupCache

$processedMarkupCache защищенное свойство

protected $processedMarkupCache

$purgeable защищенное свойство

List of attribute names which are not considered "settings".
protected $purgeable

$rules публичное свойство

The rules to be applied to the data.
public $rules

$translatable публичное свойство

Attributes that support translation, if available.
public $translatable

$translatableModel публичное свойство

Translation model used for translation, if available.
public $translatableModel

$wrapCode защищенное свойство

Wrap code section in PHP tags.
protected $wrapCode