forked from yii2mod/yii2-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwaggerUIRenderer.php
43 lines (36 loc) · 994 Bytes
/
SwaggerUIRenderer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace yii2mod\swagger;
use yii\base\Action;
/**
* Class SwaggerUIRenderer renders the UI (HTML/JS/CSS).
*
* @package yii2mod\swagger
*/
class SwaggerUIRenderer extends Action
{
/**
* @var string the rest url configuration
*/
public $restUrl;
/**
* @var string base swagger template
*/
public $view = '@vendor/yii2mod/yii2-swagger/views/index';
/**
* @var null|string|false the name of the layout to be applied to this controller's views.
* This property mainly affects the behavior of [[render()]].
* Defaults to null, meaning the actual layout value should inherit that from [[module]]'s layout value.
* If false, no layout will be applied.
*/
public $layout = false;
/**
* @inheritdoc
*/
public function run()
{
$this->controller->layout = $this->layout;
return $this->controller->render($this->view, [
'restUrl' => $this->restUrl,
]);
}
}