Cms\Classes\Snippet

Overview

Snippet represents a static page snippet.


Public Properties

public string $code

code specifies the snippet code.

Protected Properties

protected string $description

description specifies the snippet description.

protected string $name

name specifies the snippet name.

protected string $properties

properties for the snippet.

protected string $componentClass

componentClass name for the snippet.

protected bool $useAjax

useAjax for the snippet.

protected static array $pageSnippetMap

pageSnippetMap is an internal cache of snippet declarations defined on a page.

protected Cms\Classes\ComponentBase $componentObj


Public Methods

public getComponentClass()

public getComponentClass(): string 

getComponentClass returns the snippet component class name. If the snippet is a partial snippet, returns NULL.

public getDescription()

public getDescription(): string 

getDescription returns the snippet description. This method should not be used in the front-end request handling.

public getName()

public getName(): string 

getName returns the snippet name. This method should not be used in the front-end request handling.

public getProperties()

public getProperties(): void

getProperties returns the snippet property list as array, in format compatible with Inspector.

public initFromComponentInfo()

public initFromComponentInfo(
    string $componentClass,
    string $componentCode
): void

initFromComponentInfo initializes the snippet from a CMS component information.

public initFromPartial()

public initFromPartial(Cms\Classes\Partial $partial): void

initFromPartial initializes the snippet from a CMS partial.

public static processTemplateSettings()

public static processTemplateSettings($template): void

public static processTemplateSettingsArray()

public static processTemplateSettingsArray($settingsArray): void

public useAjaxPartial()

public useAjaxPartial(): bool 

useAjaxPartial determines if the snippet should have AJAX enabled.

Protected Methods

protected static dropDownOptionsToArray()

protected static dropDownOptionsToArray($optionsString): void

protected static dropDownOptionsToString()

protected static dropDownOptionsToString(mixed $optionsArray): string 

protected getComponent()

protected getComponent(): Cms\Classes\ComponentBase 

getComponent returns a component corresponding to the snippet. This method should not be used in the front-end request handling code.

protected static parseIniProperties()

protected static parseIniProperties($properties): array 

parseIniProperties converts a keyed object to an array, converting the index to the "property" value.