public function getHandler()
{
if ($this->_handler !== null) {
return $this->_handler;
}
if ($this->component) {
try {
/**
* @var $component PropertyType
*/
$foundComponent = \Yii::$app->cms->getRelatedHandler($this->component);
//TODO:: Подумать! Нужно чтобы создавался новый экземляр класса потому что в него передается property объект. В то же время хотелось бы чтобы объект handler собирался согласно настройкам конфига.
$component = clone $foundComponent;
//$component = \Yii::$app->cms->createRelatedHandler($this->component);
$component->property = $this;
$component->load($this->component_settings, "");
$this->_handler = $component;
return $this->_handler;
} catch (\Exception $e) {
//\Yii::warning("Related property handler not found '{$this->component}' or load with errors: " . $e->getMessage(), self::className());
$component = new PropertyTypeText();
$component->property = $this;
$this->_handler = $component;
return $this->_handler;
}
}
return null;
}