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.

29 lines
641 B

6 years ago
<?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
{
3 years ago
public int $id;
6 years ago
3 years ago
public function run(): string
{
6 years ago
$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]);
}
3 years ago
}