1 | <?php |
||
17 | trait DynamicContentAwareTrait |
||
18 | { |
||
19 | /** |
||
20 | * @var string[] a list of placeholders for dynamic content |
||
21 | */ |
||
22 | private $_dynamicPlaceholders; |
||
23 | |||
24 | /** |
||
25 | * Returns the view object that can be used to render views or view files using dynamic contents. |
||
26 | * @return View the view object that can be used to render views or view files. |
||
27 | */ |
||
28 | abstract protected function getView(); |
||
29 | |||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | */ |
||
33 | 21 | public function getDynamicPlaceholders() |
|
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function setDynamicPlaceholders($placeholders) |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 16 | public function addDynamicPlaceholder($name, $statements) |
|
53 | |||
54 | /** |
||
55 | * Replaces placeholders in $content with results of evaluated dynamic statements. |
||
56 | * @param string $content content to be parsed. |
||
57 | * @param string[] $placeholders placeholders and their values. |
||
58 | * @param bool $isRestoredFromCache whether content is going to be restored from cache. |
||
59 | * @return string final content. |
||
60 | */ |
||
61 | 21 | protected function updateDynamicContent($content, $placeholders, $isRestoredFromCache = false) |
|
83 | } |
||
84 |