* Add extra field to formpanel.

This commit is contained in:
wangyuting
2024-03-27 11:06:45 +08:00
committed by liyang
parent 147cd03772
commit 7cd298a7c6
2 changed files with 32 additions and 1 deletions
+2 -1
View File
@@ -105,7 +105,8 @@ class detailBody extends wg
),
$side
)
)
),
html($app->control->appendExtendCssAndJS())
);
}
}
+30
View File
@@ -170,6 +170,35 @@ class formPanel extends panel
return parent::buildHeadingActions();
}
protected function buildExtraMain()
{
global $app;
$layout = $this->prop('layout');
if($layout == 'grid') return null;
$fields = $app->control->appendExtendForm('info', data($app->getModuleName()));
$extraMain = array();
foreach($fields as $field)
{
$extraMain[] = formGroup
(
set::width($field->width),
set::label($field->name),
formGroup
(
set::id($field->field),
set::name($field->field),
set::required($field->required),
set::control($field->control),
set::items($field->items),
set::value($field->value)
)
);
}
return $extraMain;
}
/**
* Build form widget by mode.
*
@@ -212,6 +241,7 @@ class formPanel extends panel
set::className($this->prop('formClass')),
set($this->props->pick($formProps)),
$this->children(),
$this->buildExtraMain(),
$hiddenFields ? jsVar('hiddenFields', $hiddenFields) : null
);
}