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

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

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

Свойство Тип Описание
$code Specifies the snippet code.

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

Свойство Тип Описание
$componentClass Snippet component class name.
$componentObj Snippet component object.
$description Specifies the snippet description.
$name Specifies the snippet name.
$pageSnippetMap Internal cache of snippet declarations defined on a page.
$properties Snippet properties.

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

Метод Описание
__construct ( )
clearMapCache ( Cms\Classes\Theme $theme ) Clears the snippet map item cache
extendPartialForm ( $formWidget ) Extends the partial form with Snippet fields.
getComponentClass ( ) : string Returns the snippet component class name.
getDescription ( ) : string Returns the snippet description.
getName ( ) : string Returns the snippet name.
getProperties ( ) Returns the snippet property list as array, in format compatible with Inspector.
initFromComponentInfo ( string $componentClass, string $componentCode ) Initializes the snippet from a CMS component information.
initFromPartial ( $partial ) Initializes the snippet from a CMS partial.
listPageComponents ( string $pageName, Cms\Classes\Theme $theme, $markup ) : array Returns a list of component definitions declared on the page.
processPageMarkup ( string $pageName, Cms\Classes\Theme $theme, string $markup ) : string Parses the static page markup and renders snippets defined on the page.
processTemplateSettings ( $template )
processTemplateSettingsArray ( $settingsArray )

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

Метод Описание
dropDownOptionsToArray ( $optionsString )
dropDownOptionsToString ( $optionsArray )
extractSnippetsFromMarkup ( $markup, $theme )
extractSnippetsFromMarkupCached ( $theme, $pageName, $markup )
getComponent ( ) : Cms\Classes\ComponentBase Returns a component corresponding to the snippet.
getMapCacheKey ( $theme ) Returns a cache key for this record.
parseIniProperties ( $properties ) : array Converts a keyed object to an array, converting the index to the "property" value.
preprocessPropertyValues ( $theme, $snippetCode, $componentClass, $properties ) Apples default property values and fixes property names.

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

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

public __construct ( )

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

Clears the snippet map item cache
public static clearMapCache ( Cms\Classes\Theme $theme )
$theme Cms\Classes\Theme Specifies the current theme.

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

protected static dropDownOptionsToArray ( $optionsString )

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

protected static dropDownOptionsToString ( $optionsArray )

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

Extends the partial form with Snippet fields.
public static extendPartialForm ( $formWidget )

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

protected static extractSnippetsFromMarkup ( $markup, $theme )

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

protected static extractSnippetsFromMarkupCached ( $theme, $pageName, $markup )

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

This method should not be used in the front-end request handling code.
protected getComponent ( ) : Cms\Classes\ComponentBase
Результат Cms\Classes\ComponentBase

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

If the snippet is a partial snippet, returns NULL.
public getComponentClass ( ) : string
Результат string Returns the snippet component class name

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

This method should not be used in the front-end request handling.
public getDescription ( ) : string
Результат string

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

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

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

This method should not be used in the front-end request handling.
public getName ( ) : string
Результат string

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

Returns the snippet property list as array, in format compatible with Inspector.
public getProperties ( )

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

Initializes the snippet from a CMS component information.
public initFromComponentInfo ( string $componentClass, string $componentCode )
$componentClass string Specifies the component class.
$componentCode string Specifies the component code.

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

Initializes the snippet from a CMS partial.
public initFromPartial ( $partial )

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

Returns a list of component definitions declared on the page.
public static listPageComponents ( string $pageName, Cms\Classes\Theme $theme, $markup ) : array
$pageName string Specifies the static page file name (the name of the corresponding content block file).
$theme Cms\Classes\Theme Specifies a parent theme.
Результат array Returns an array of component definitions

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

Converts a keyed object to an array, converting the index to the "property" value.
protected static parseIniProperties ( $properties ) : array
Результат array

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

As snippet properties are defined with data attributes, they are lower case, whereas real property names are case sensitive. This method finds original property names defined in snippet classes or partials and replaces property names defined in the static page markup.
protected static preprocessPropertyValues ( $theme, $snippetCode, $componentClass, $properties )

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

Parses the static page markup and renders snippets defined on the page.
public static processPageMarkup ( string $pageName, Cms\Classes\Theme $theme, string $markup ) : string
$pageName string Specifies the static page file name (the name of the corresponding content block file).
$theme Cms\Classes\Theme Specifies a parent theme.
$markup string Specifies the markup string to process.
Результат string Returns the processed string.

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

public static processTemplateSettings ( $template )

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

public static processTemplateSettingsArray ( $settingsArray )

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

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

Specifies the snippet code.
public $code

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

Snippet component class name.
protected $componentClass

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

Snippet component object.
protected $componentObj

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

Specifies the snippet description.
protected $description

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

Specifies the snippet name.
protected $name

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

Internal cache of snippet declarations defined on a page.
protected static $pageSnippetMap

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

Snippet properties.
protected $properties