# ViewContextInterface

> ViewContextInterface is the interface that should implemented by classes who want to support relative view names.

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

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

Implemented by 5 types:

- [`Controller`](/docs/api/yii/base/controller/index.md)
- [`Widget`](/docs/api/yii/base/widget/index.md)
- [`yii\mail\BaseMailer`](/docs/api/yii/mail/basemailer/index.md)
- [`yii\debug\Panel`](/docs/extensions/debug/reference/panel/index.md)
- [`yii\debug\actions\Action`](/docs/extensions/debug/reference/actions/action/index.md)

ViewContextInterface is the interface that should implemented by classes who want to support relative view names.

The method [`getViewPath()`](/docs/api/yii/base/viewcontextinterface/index.md#method-getViewPath) should be implemented to return the view path that may be prefixed to a relative view name.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`getViewPath()`](#method-getViewPath) abstract |  | `ViewContextInterface` |

## Method details

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

```php
abstract public function getViewPath(): string
```

**Returns**

`string`: The view path that may be prefixed to a relative view name.