diff --git a/app/src/View/Helper/FieldHelper.php b/app/src/View/Helper/FieldHelper.php index fd4b88c23..c17c31f81 100644 --- a/app/src/View/Helper/FieldHelper.php +++ b/app/src/View/Helper/FieldHelper.php @@ -386,7 +386,10 @@ protected function formInfoDiv(string $content, } /** - * Generate a form info (control, value) box. + * Create grouped control elements. By default, the elements will be placed one after the other, inline, + * with a direction left to right. For that need to occupy the whole row we defined the 'singleRowItem' + * configuration property that will add an inline Bootstrap css rule. The rule will override the default + * behavior * * @param array $fields * @param string $pseudoFieldName @@ -397,24 +400,18 @@ protected function formInfoDiv(string $content, * @since COmanage Registry v5.0.0 */ - public function formInfoWithMultipleControls(array $fields, - string $pseudoFieldName, - string $beforeField = '', - string $afterField = ''): string { + public function groupedControls(array $fields, + string $pseudoFieldName, + string $beforeField = '', + string $afterField = ''): string { $content = ''; foreach ($fields as $fieldName => $fieldOptions) { - if(isset($fieldOptions['type']) - && $fieldOptions['type'] == 'checkbox') { - $content .= '
' . PHP_EOL; - $content .= $this->formControl($fieldName) . PHP_EOL; - $content .= '
' . PHP_EOL; - } else { - $content .= '
' . PHP_EOL; - $content .= '
' . PHP_EOL; - $content .= $this->formControl($fieldName, $fieldOptions['options'] ?? []) . PHP_EOL; - $content .= '
' . PHP_EOL; - $content .= '
' . PHP_EOL; - } + $dblock = isset($fieldOptions['singleRowItem']) && $fieldOptions['singleRowItem'] ? 'd-block' : ''; + $content .= "
" . PHP_EOL; + $content .= '
' . PHP_EOL; + $content .= $this->formControl($fieldName, $fieldOptions['options'] ?? []) . PHP_EOL; + $content .= '
' . PHP_EOL; + $content .= '
' . PHP_EOL; } $mn = $this->modelName; diff --git a/app/templates/CoSettings/fields.inc b/app/templates/CoSettings/fields.inc index 676dd1d2d..983f808ea 100644 --- a/app/templates/CoSettings/fields.inc +++ b/app/templates/CoSettings/fields.inc @@ -54,7 +54,7 @@ if($vv_action == 'edit') { print $this->Field->control('search_global_limited_models'); - print $this->Field->formInfoWithMultipleControls( + print $this->Field->groupedControls( [ 'person_picker_email_address_type_id' => [ 'options' => [ @@ -69,8 +69,8 @@ if($vv_action == 'edit') { ], ], 'person_picker_display_types' => [ - 'type' => 'checkbox' - ], + 'singleRowItem' => true + ] ], 'person_picker_display_fields' );