PHP Class RainLab\Pages\Classes\Snippet

Author: Alexey Bobkov, Samuel Georges
Afficher le fichier Open project: rainlab/pages-plugin Class Usage Examples

Méthodes publiques

Свойство Type Description
$code Specifies the snippet code.

Protected Properties

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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 )

Méthodes protégées

Méthode Description
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.

Method Details

__construct() public méthode

public __construct ( )

clearMapCache() public static méthode

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

dropDownOptionsToArray() protected static méthode

protected static dropDownOptionsToArray ( $optionsString )

dropDownOptionsToString() protected static méthode

protected static dropDownOptionsToString ( $optionsArray )

extendPartialForm() public static méthode

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

extractSnippetsFromMarkup() protected static méthode

protected static extractSnippetsFromMarkup ( $markup, $theme )

extractSnippetsFromMarkupCached() protected static méthode

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

getComponent() protected méthode

This method should not be used in the front-end request handling code.
protected getComponent ( ) : Cms\Classes\ComponentBase
Résultat Cms\Classes\ComponentBase

getComponentClass() public méthode

If the snippet is a partial snippet, returns NULL.
public getComponentClass ( ) : string
Résultat string Returns the snippet component class name

getDescription() public méthode

This method should not be used in the front-end request handling.
public getDescription ( ) : string
Résultat string

getMapCacheKey() protected static méthode

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

getName() public méthode

This method should not be used in the front-end request handling.
public getName ( ) : string
Résultat string

getProperties() public méthode

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

initFromComponentInfo() public méthode

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() public méthode

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

listPageComponents() public static méthode

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.
Résultat array Returns an array of component definitions

parseIniProperties() protected static méthode

Converts a keyed object to an array, converting the index to the "property" value.
protected static parseIniProperties ( $properties ) : array
Résultat array

preprocessPropertyValues() protected static méthode

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() public static méthode

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.
Résultat string Returns the processed string.

processTemplateSettings() public static méthode

public static processTemplateSettings ( $template )

processTemplateSettingsArray() public static méthode

public static processTemplateSettingsArray ( $settingsArray )

Property Details

$code public_oe property

Specifies the snippet code.
public $code

$componentClass protected_oe property

Snippet component class name.
protected $componentClass

$componentObj protected_oe property

Snippet component object.
protected $componentObj

$description protected_oe property

Specifies the snippet description.
protected $description

$name protected_oe property

Specifies the snippet name.
protected $name

$pageSnippetMap protected_oe static_oe property

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

$properties protected_oe property

Snippet properties.
protected $properties