PHP Class RainLab\Pages\Classes\Menu

Author: Alexey Bobkov, Samuel Georges
Inheritance: extends Cms\Classes\CmsObject
Datei anzeigen Open project: rainlab/pages-plugin Class Usage Examples

Protected Properties

Property Type Description
$allowedExtensions Allowable file extensions.
$contentDataCache Cache store used by parseContent method.
$defaultExtension Default file extension.
$dirName The container name associated with the model, eg: pages.
$fillable The attributes that are mass assignable.
$purgeable List of attribute names which are not considered "settings".

Public Methods

Method Description
beforeSave ( ) : void Triggered before the menu is saved.
beforeValidate ( ) : void Validate custom attributes.
generateReferences ( Cms\Classes\Page $page ) : array Returns the menu item references.
getCodeAttribute ( ) : string Returns the menu code.
getItemDataAttribute ( ) : array Returns a default value for itemData attribute.
getItemsAttribute ( ) : array Returns a default value for items attribute.
getNameAttribute ( ) : string Returns a default value for name attribute.
initCacheItem ( &$item ) Initializes a cache item.
setCodeAttribute ( string $code ) : Cms\Classes\CmsObject Sets the menu code.

Protected Methods

Method Description
parseContent ( ) : array | null Processes the content attribute to an array of menu data.
renderContent ( ) : string Renders the menu data as a content string in YAML format.

Method Details

beforeSave() public method

Triggered before the menu is saved.
public beforeSave ( ) : void
return void

beforeValidate() public method

Validate custom attributes.
public beforeValidate ( ) : void
return void

generateReferences() public method

This function is used on the front-end.
public generateReferences ( Cms\Classes\Page $page ) : array
$page Cms\Classes\Page The current page object.
return array Returns an array of the \RainLab\Pages\Classes\MenuItemReference objects.

getCodeAttribute() public method

Returns the menu code.
public getCodeAttribute ( ) : string
return string

getItemDataAttribute() public method

Returns a default value for itemData attribute.
public getItemDataAttribute ( ) : array
return array

getItemsAttribute() public method

Items are objects of the \RainLab\Pages\Classes\MenuItem class.
public getItemsAttribute ( ) : array
return array

getNameAttribute() public method

Returns a default value for name attribute.
public getNameAttribute ( ) : string
return string

initCacheItem() public static method

Initializes a cache item.
public static initCacheItem ( &$item )

parseContent() protected method

Processes the content attribute to an array of menu data.
protected parseContent ( ) : array | null
return array | null

renderContent() protected method

Renders the menu data as a content string in YAML format.
protected renderContent ( ) : string
return string

setCodeAttribute() public method

Sets the menu code.
public setCodeAttribute ( string $code ) : Cms\Classes\CmsObject
$code string Specifies the file code.
return Cms\Classes\CmsObject Returns the object instance.

Property Details

$allowedExtensions protected_oe property

Allowable file extensions.
protected $allowedExtensions

$contentDataCache protected_oe property

Cache store used by parseContent method.
protected $contentDataCache

$defaultExtension protected_oe property

Default file extension.
protected $defaultExtension

$dirName protected_oe property

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

$fillable protected_oe property

The attributes that are mass assignable.
protected $fillable

$purgeable protected_oe property

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