Contents

Cms\Classes\Page

Overview

Page template class

Extends
Implements
  • ArrayAccess
  • Illuminate\Contracts\Support\Arrayable
  • Illuminate\Contracts\Support\Jsonable
  • JsonSerializable
  • Stringable
  • Cms\Contracts\CmsObject

Public Properties

public array $apiBag

The API bag allows the API handler code to bind arbitrary data to the page object.

public array $rules

rules to be applied to the data.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected string $dirName

dirName associated with the model, eg: pages.

protected array $fillable

The attributes that are mass assignable.

protected array $parsable

parsable attributes support using parsed variables.

protected array $parsableAttributes

parsableAttributes contains the translated attributes

protected mixed $translatableBagCache

translatableBagCache store for the getTranslatableBag method.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public __get()

public __get($key): void

__get with parsable attribute override.

public addParsable()

public addParsable($attributes = null): void

addParsable attributes for the model

public applyTranslatableContext()

public applyTranslatableContext(
    System\Models\SiteDefinition|null $site = null
): void 

applyTranslatableContext overrides page attributes with translated values for a site.

public beforeValidate()

public beforeValidate(): void

beforeValidate applies custom validation rules

public getCodeClassParent()

public getCodeClassParent(): mixed 

getCodeClassParent returns name of a PHP class to us a parent for the PHP class created for the object's PHP section.

public getLayoutOptions()

public getLayoutOptions(): array 

getLayoutOptions returns a list of layouts available in the theme. This method is used by the form widget.

public static getMenuTypeInfo()

public static getMenuTypeInfo(string $type): array 

getMenuTypeInfo handler for the cms.pageLookup.getTypeInfo event. 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 getNameList()

public static getNameList(): array 

getNameList helper that returns a nicer list of pages for use in dropdowns.

public getParsableAttributeValues()

public getParsableAttributeValues(): array 

getParsableAttributes

public getTranslatableBag()

public getTranslatableBag(): Cms\Components\TranslatableBag 

getTranslatableBag returns the configured translatable component.

public getTranslatableUrl()

public getTranslatableUrl(
    System\Models\SiteDefinition|null $site = null
): string|null 

getTranslatableUrl returns the translated URL pattern for a site, if available.

public getTranslatableValue()

public getTranslatableValue(
    string $name,
    System\Models\SiteDefinition|null $site = null
): string|null 

getTranslatableValue returns a translated property value for a site, if available. The name avoids the get*Attribute convention since translatable is a real attribute.

public static resolveMenuItem()

public static resolveMenuItem(
    Cms\Models\PageLookupItem $item,
    string $url,
    Cms\Classes\Theme $theme
): mixed 

resolveMenuItem handler for the cms.pageLookup.resolveItem event. 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 Url::to() 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 setParsableAttribute()

public setParsableAttribute($key, $value): void 

public static url()

public static url($page, $params = []): void

Show inherited public methods

Inherited Public Methods

Protected Methods

protected isTranslatableEnabled()

protected isTranslatableEnabled(): bool 

isTranslatableEnabled checks the multisite page translation feature is active.

Show inherited protected methods

Inherited Protected Methods