feat: FakeTemplate -> JsonView
This commit is contained in:
parent
18cc1cad01
commit
5170ed8ed5
2 changed files with 12 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ use ctiso\Controller\SiteInterface;
|
|||
use ctiso\Database\PDOStatement;
|
||||
use PHPTAL;
|
||||
use PHPTAL_PreFilter_Normalize;
|
||||
use ctiso\View\FakeTemplate;
|
||||
use ctiso\View\JsonView;
|
||||
|
||||
/**
|
||||
* Класс компонента
|
||||
|
|
@ -117,12 +117,12 @@ class Component
|
|||
/**
|
||||
* Получить шаблон
|
||||
* @param string $name
|
||||
* @return PHPTAL|FakeTemplate
|
||||
* @return PHPTAL|JsonView
|
||||
*/
|
||||
public function getView($name)
|
||||
{
|
||||
if ($this->output === 'json') {
|
||||
return new FakeTemplate($name);
|
||||
return new JsonView($name);
|
||||
}
|
||||
|
||||
/** @var Registry $config */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace ctiso\View;
|
||||
|
||||
class FakeTemplate extends \stdClass {
|
||||
class JsonView extends \stdClass {
|
||||
/** @var array */
|
||||
public $_data = [];
|
||||
/** @var string */
|
||||
|
|
@ -15,6 +15,14 @@ class FakeTemplate extends \stdClass {
|
|||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
function set($key, $value): void {
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
Loading…
Add table
Add a link
Reference in a new issue