You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

27 lines
624 B

<?php
/**
* Created by Error202
* Date: 31.07.2018
*/
namespace common\modules\forms\widgets;
use common\modules\forms\entities\Form;
use yii\base\Widget;
class FormWidget extends Widget
{
public $id;
public function run() {
$form = Form::findOne($this->id);
if (!$form) {
return 'Form is not found';
}
$className = 'DynaForm' . $this->id;
$classPath = '\\common\\modules\\forms\\runtime\\' . $className;
$dynaForm = new $classPath();
return $this->renderFile(\Yii::getAlias('@common/modules/forms/runtime/' . 'DynaView' . $this->id . '.php'), ['model' => $dynaForm, 'form_entity' => $form]);
}
}