DynamicContentAwareTrait
DynamicContentAwareTrait implements common methods for classes which support a [[View]] dynamic content feature.
Tags
Table of Contents
Properties
- $_dynamicPlaceholders : array<string|int, string>
Methods
- addDynamicPlaceholder() : mixed
- {@inheritdoc}
- getDynamicPlaceholders() : mixed
- {@inheritdoc}
- setDynamicPlaceholders() : mixed
- {@inheritdoc}
- getView() : View
- Returns the view object that can be used to render views or view files using dynamic contents.
- updateDynamicContent() : string
- Replaces placeholders in $content with results of evaluated dynamic statements.
Properties
$_dynamicPlaceholders
private
array<string|int, string>
$_dynamicPlaceholders
a list of placeholders for dynamic content
Methods
addDynamicPlaceholder()
{@inheritdoc}
public
addDynamicPlaceholder(mixed $name, mixed $statements) : mixed
Parameters
- $name : mixed
- $statements : mixed
getDynamicPlaceholders()
{@inheritdoc}
public
getDynamicPlaceholders() : mixed
setDynamicPlaceholders()
{@inheritdoc}
public
setDynamicPlaceholders(mixed $placeholders) : mixed
Parameters
- $placeholders : mixed
getView()
Returns the view object that can be used to render views or view files using dynamic contents.
protected
abstract getView() : View
Return values
View —the view object that can be used to render views or view files.
updateDynamicContent()
Replaces placeholders in $content with results of evaluated dynamic statements.
protected
updateDynamicContent(string $content, array<string|int, string> $placeholders[, bool $isRestoredFromCache = false ]) : string
Parameters
- $content : string
-
content to be parsed.
- $placeholders : array<string|int, string>
-
placeholders and their values.
- $isRestoredFromCache : bool = false
-
whether content is going to be restored from cache.
Return values
string —final content.