Merge pull request #17042 from marcusmoore/chore/replace-customfield-elements-macro-take-two
Replace customfield_elements form macro take two
This commit is contained in:
@@ -60,5 +60,11 @@ return [
|
||||
'display_checkin' => 'Display in checkin forms',
|
||||
'display_checkout' => 'Display in checkout forms',
|
||||
'display_audit' => 'Display in audit forms',
|
||||
|
||||
'types' => [
|
||||
'text' => 'Text Box',
|
||||
'listbox' => 'List Box',
|
||||
'textarea' => 'Textarea (multi-line)',
|
||||
'checkbox' => 'Checkbox',
|
||||
'radio' => 'Radio Buttons',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -219,22 +219,3 @@ Form::macro('username_format', function ($name = 'username_format', $selected =
|
||||
|
||||
return $select;
|
||||
});
|
||||
|
||||
Form::macro('customfield_elements', function ($name = 'customfield_elements', $selected = null, $class = null) {
|
||||
$formats = [
|
||||
'text' => 'Text Box',
|
||||
'listbox' => 'List Box',
|
||||
'textarea' => 'Textarea (multi-line) ',
|
||||
'checkbox' => 'Checkbox',
|
||||
'radio' => 'Radio Buttons',
|
||||
];
|
||||
|
||||
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
|
||||
foreach ($formats as $format => $label) {
|
||||
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
|
||||
}
|
||||
|
||||
$select .= '</select>';
|
||||
|
||||
return $select;
|
||||
});
|
||||
|
||||
@@ -58,7 +58,19 @@
|
||||
</label>
|
||||
<div class="col-md-8 required">
|
||||
|
||||
{!! Form::customfield_elements('element', old('element', $field->element), 'field_element select2 form-control') !!}
|
||||
<x-input.select
|
||||
name="element"
|
||||
:selected="old('element', $field->element)"
|
||||
class="field_element"
|
||||
style="width: 100%;"
|
||||
:options="[
|
||||
'text' => trans('admin/custom_fields/general.types.text'),
|
||||
'listbox' => trans('admin/custom_fields/general.types.listbox'),
|
||||
'textarea' => trans('admin/custom_fields/general.types.textarea'),
|
||||
'checkbox' => trans('admin/custom_fields/general.types.checkbox'),
|
||||
'radio' => trans('admin/custom_fields/general.types.radio'),
|
||||
]"
|
||||
/>
|
||||
{!! $errors->first('element', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user