refactor: Form больше не наследует View

This commit is contained in:
origami11@yandex.ru 2025-04-03 19:59:56 +03:00
parent 2f8c788664
commit 6ef65fc826
4 changed files with 10 additions and 29 deletions

View file

@ -15,7 +15,7 @@ use ctiso\Form\Field,
/**
* Форма для ввода
*/
class Form extends View {
class Form {
public $field = array(); //Поля формы
public $fieldsets = array(); //Группы полей (fieldset). Некоторые поля могут не принадлежать никаким группам
@ -28,7 +28,7 @@ class Form extends View {
public $_title = array();
public $alias = array();
public $constructor = array();
private $constructor = array();
/**
* Строим форму по ее структуре. Каждому типу соответствует определенный класс.
@ -175,7 +175,7 @@ class Form extends View {
{
foreach ($schema as $key => $conv) {
list($value, $type) = $conv;
$this->field [$key]->setValue(call_user_func(['ctiso\\Primitive', 'from_' . $type], $data->$value));
$this->field [$key]->setValue(call_user_func([\ctiso\Primitive::class, 'from_' . $type], $data->$value));
}
}
@ -183,17 +183,7 @@ class Form extends View {
{
$this->field[$name]->setValue($value);
}
public function getSchema() {
return [
'field' => $this->field,
'fieldset' => $this->fieldsets,
'method' => $this->method,
'action' => $this->action,
'header' => $this->header
];
}
function execute()
{
return $this;