InlineFormView: combine fields and buttons into one 'controls' array
This commit is contained in:
parent
0274ff5bf4
commit
77fa33730a
@ -25,7 +25,7 @@ class ManageAssets extends HTMLController
|
|||||||
'method' => 'post',
|
'method' => 'post',
|
||||||
'class' => 'col-md-6 text-end',
|
'class' => 'col-md-6 text-end',
|
||||||
'is_embed' => true,
|
'is_embed' => true,
|
||||||
'buttons' => [
|
'controls' => [
|
||||||
'deleteChecked' => [
|
'deleteChecked' => [
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'caption' => 'Delete checked',
|
'caption' => 'Delete checked',
|
||||||
|
@ -30,7 +30,7 @@ class ManageErrors extends HTMLController
|
|||||||
'action' => BASEURL . '/manageerrors/?' . Session::getSessionTokenKey() . '=' . Session::getSessionToken(),
|
'action' => BASEURL . '/manageerrors/?' . Session::getSessionTokenKey() . '=' . Session::getSessionToken(),
|
||||||
'method' => 'post',
|
'method' => 'post',
|
||||||
'class' => 'col-md-6 text-end',
|
'class' => 'col-md-6 text-end',
|
||||||
'buttons' => [
|
'controls' => [
|
||||||
'clear' => [
|
'clear' => [
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'caption' => 'Delete all',
|
'caption' => 'Delete all',
|
||||||
|
@ -21,7 +21,7 @@ class ManageTags extends HTMLController
|
|||||||
'action' => BASEURL . '/edittag/',
|
'action' => BASEURL . '/edittag/',
|
||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
'class' => 'col-md-6 text-end',
|
'class' => 'col-md-6 text-end',
|
||||||
'buttons' => [
|
'controls' => [
|
||||||
'add' => [
|
'add' => [
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'caption' => 'Add new tag',
|
'caption' => 'Add new tag',
|
||||||
|
@ -21,7 +21,7 @@ class ManageUsers extends HTMLController
|
|||||||
'action' => BASEURL . '/edituser/',
|
'action' => BASEURL . '/edituser/',
|
||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
'class' => 'col-md-6 text-end',
|
'class' => 'col-md-6 text-end',
|
||||||
'buttons' => [
|
'controls' => [
|
||||||
'add' => [
|
'add' => [
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'caption' => 'Add new user',
|
'caption' => 'Add new user',
|
||||||
|
@ -21,26 +21,19 @@ class InlineFormView
|
|||||||
echo '
|
echo '
|
||||||
<div class="input-group">';
|
<div class="input-group">';
|
||||||
|
|
||||||
if (!empty($form['fields']))
|
foreach ($form['controls'] as $name => $control)
|
||||||
{
|
{
|
||||||
foreach ($form['fields'] as $name => $field)
|
if ($control['type'] === 'select')
|
||||||
{
|
self::renderSelectBox($control, $name);
|
||||||
if ($field['type'] === 'select')
|
elseif ($control['type'] === 'submit')
|
||||||
self::renderSelectBox($field, $name);
|
self::renderSubmitButton($control, $name);
|
||||||
else
|
else
|
||||||
self::renderInputBox($field, $name);
|
self::renderInputBox($control, $name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<input type="hidden" name="', Session::getSessionTokenKey(), '" value="', Session::getSessionToken(), '">';
|
<input type="hidden" name="', Session::getSessionTokenKey(), '" value="', Session::getSessionToken(), '">';
|
||||||
|
|
||||||
if (!empty($form['buttons']))
|
|
||||||
foreach ($form['buttons'] as $name => $button)
|
|
||||||
{
|
|
||||||
self::renderSubmitButton($button, $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($form['is_group']))
|
if (!empty($form['is_group']))
|
||||||
echo '
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user