ldc-legaulois/resources/views/bo/partials/inputs/text-html.blade.php
2024-09-06 10:06:32 +02:00

42 lines
1.9 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
$editorConfig || The config of Ckeditor to use || string || OPTIONNAL || basic
--}}
@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 ?? '')) !== null ? old($name, $model->{$name} ?? ($value ?? '')) : '',
'editorConfig' => $editorConfig ?? \App\Enums\CkEditorConfigName::basic->label(),
'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,
]),
])