ldc-volena/resources/views/bo/partials/inputs/text-html.blade.php
2025-03-14 10:50:26 +01:00

39 lines
1.7 KiB
PHP

{{--
VARIABLE || COMMENT || TYPE || REQUIRED || DEFAULT
$id || The id of the input tag. || string || REQUIRED ||
$name || The name of the input tag. || string || REQUIRED ||
$helper || The helper of the input. || string || OPTIONNAL || __('crud.minicrud.text_warning')
$label || The text displayed as a label. || string || OPTIONNAL || null
$required || Is the field required ? || boolean || OPTIONNAL || false
$value || The default value of the input. || string || OPTIONNAL || ''
$model || The model we're creating/editing || Model class || OPTIONNAL || null
--}}
@if (!empty($label))
<label class="col-form-label" for="{{ $id }}">
<b>{{ $label }} {{ $required ?? false ? '*' : '' }}</b>
</label>
@endif
@php
$data = [
'modelName' => class_basename($model),
'name' => $name,
'text' => old($name, $model->{$name} ?? ($value ?? '')),
'placeholder' => $placeholder ?? __('Un text riche'),
'errors' => $errors->getBag('default')->getMessages() ?? [],
'editorConfig' => $editorConfig ?? \App\Enums\CkEditorConfigName::basic->label(),
];
@endphp
<div class="ck-editor" data-json='@json($data)'></div>
@include('modules.input-error', [
'inputName' => $name,
'helperId' => "{$id}Help",
'helper' =>
$helper ??
__('crud.minicrud.text_warning') .
__('validation.min.string', [
'attribute' => $input['label'],
'min' => 15,
]),
])