\n"; $info = '

' . $title . '

' . $subtitle . '

'; return $section . $info . '
'; } } //-------------------------------------------------------------------- if (!function_exists('form_section_close')) { /** * Form Section close Tag * * @param string $extra * * @return string */ function form_section_close(string $extra = ''): string { return '
' . $extra; } } //-------------------------------------------------------------------- if (!function_exists('form_switch')) { /** * Form Checkbox Switch * * Abstracts form_label to stylize it as a switch toggle * * @param array $data * @param string $value * @param boolean $checked * @param mixed $extra * * @return string */ function form_switch( $label = '', $data = '', string $value = '', bool $checked = false, $class = '', $extra = '' ): string { $data['class'] = 'form-switch'; return ''; } } //-------------------------------------------------------------------- if (!function_exists('form_label')) { /** * Form Label Tag * * @param string $label_text The text to appear onscreen * @param string $id The id the label applies to * @param array $attributes Additional attributes * @param string $hintText Hint text to add next to the label * @param boolean $isOptional adds an optional text if true * * @return string */ function form_label( string $label_text = '', string $id = '', array $attributes = [], string $hintText = '', bool $isOptional = false ): string { $label = ' $val) { $label .= ' ' . $key . '="' . $val . '"'; } } $label_content = $label_text; if ($isOptional) { $label_content .= '(' . lang('Common.optional') . ')'; } if ($hintText !== '') { $label_content .= hint_tooltip($hintText, 'ml-1'); } return $label . '>' . $label_content . ''; } } //-------------------------------------------------------------------- if (!function_exists('form_multiselect')) { /** * Multi-select menu * * @param string $name * @param array $options * @param array $selected * @param mixed $extra * * @return string */ function form_multiselect( string $name = '', array $options = [], array $selected = [], $customExtra = '' ): string { $defaultExtra = [ 'data-class' => $customExtra['class'], 'data-select-text' => lang('Common.forms.multiSelect.selectText'), 'data-loading-text' => lang('Common.forms.multiSelect.loadingText'), 'data-no-results-text' => lang( 'Common.forms.multiSelect.noResultsText' ), 'data-no-choices-text' => lang( 'Common.forms.multiSelect.noChoicesText' ), 'data-max-item-text' => lang( 'Common.forms.multiSelect.maxItemText' ), ]; $extra = stringify_attributes(array_merge($defaultExtra, $customExtra)); if (stripos($extra, 'multiple') === false) { $extra .= ' multiple="multiple"'; } return form_dropdown($name, $options, $selected, $extra); } } //--------------------------------------------------------------------