# DynamicContentAwareInterface

> DynamicContentAwareInterface is the interface that should be implemented by classes which support a yii\base\View dynamic content feature.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [base](/docs/api/yii/base/index.md) › DynamicContentAwareInterface

| interface | `yii\base\DynamicContentAwareInterface` |
| --- | --- |
| Since | 2.0.14 |
| Source | [`framework/base/DynamicContentAwareInterface.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/base/DynamicContentAwareInterface.php#L18) |

Implemented by 3 types:

- [`View`](/docs/api/yii/base/view/index.md)
- [`yii\filters\PageCache`](/docs/api/yii/filters/pagecache/index.md)
- [`yii\widgets\FragmentCache`](/docs/api/yii/widgets/fragmentcache/index.md)

DynamicContentAwareInterface is the interface that should be implemented by classes
which support a [`View`](/docs/api/yii/base/view/index.md) dynamic content feature.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`addDynamicPlaceholder()`](#method-addDynamicPlaceholder) abstract | Adds a placeholder for dynamic content. | `DynamicContentAwareInterface` |
| [`getDynamicPlaceholders()`](#method-getDynamicPlaceholders) abstract | Returns a list of placeholders for dynamic content. This method is used internally to implement the content caching feature. | `DynamicContentAwareInterface` |
| [`setDynamicPlaceholders()`](#method-setDynamicPlaceholders) abstract | Sets a list of placeholders for dynamic content. This method is used internally to implement the content caching feature. | `DynamicContentAwareInterface` |

## Method details

### addDynamicPlaceholder() <span id="method-addDynamicPlaceholder"></span>

```php
abstract public function addDynamicPlaceholder(string $name, string $statements): mixed
```

Adds a placeholder for dynamic content.

This method is used internally to implement the content caching feature.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | The placeholder name. |
| `$statements` | `string` | The PHP statements for generating the dynamic content. |

**Returns**

`mixed`

### getDynamicPlaceholders() <span id="method-getDynamicPlaceholders"></span>

```php
abstract public function getDynamicPlaceholders(): array
```

Returns a list of placeholders for dynamic content. This method
is used internally to implement the content caching feature.

**Returns**

`array`: A list of placeholders.

### setDynamicPlaceholders() <span id="method-setDynamicPlaceholders"></span>

```php
abstract public function setDynamicPlaceholders(array $placeholders): mixed
```

Sets a list of placeholders for dynamic content. This method
is used internally to implement the content caching feature.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$placeholders` | `array` | A list of placeholders. |

**Returns**

`mixed`