@php use Filament\Support\Enums\VerticalAlignment; @endphp @props([ 'areHtmlErrorMessagesAllowed' => null, 'errorMessage' => null, 'errorMessages' => null, 'field' => null, 'hasErrors' => true, 'hasInlineLabel' => null, 'hasNestedRecursiveValidationRules' => null, 'id' => null, 'inlineLabelVerticalAlignment' => VerticalAlignment::Start, 'isDisabled' => null, 'label' => null, 'labelPrefix' => null, 'labelSrOnly' => null, 'labelSuffix' => null, 'labelTag' => 'label', 'required' => null, 'shouldShowAllValidationMessages' => null, 'statePath' => null, ]) @php use Illuminate\Support\Arr; if ($field) { $hasInlineLabel ??= $field->hasInlineLabel(); $hasNestedRecursiveValidationRules ??= $field instanceof \Filament\Forms\Components\Contracts\HasNestedRecursiveValidationRules; $id ??= $field->getId(); $isDisabled ??= $field->isDisabled(); $label ??= $field->getLabel(); $labelSrOnly ??= $field->isLabelHidden(); $required ??= $field->isMarkedAsRequired(); $statePath ??= $field->getStatePath(); $areHtmlErrorMessagesAllowed ??= $field->areHtmlValidationMessagesAllowed(); $shouldShowAllValidationMessages ??= $field->shouldShowAllValidationMessages(); } $aboveLabelSchema = $field?->getChildSchema($field::ABOVE_LABEL_SCHEMA_KEY)?->toHtmlString(); $belowLabelSchema = $field?->getChildSchema($field::BELOW_LABEL_SCHEMA_KEY)?->toHtmlString(); $beforeLabelSchema = $field?->getChildSchema($field::BEFORE_LABEL_SCHEMA_KEY)?->toHtmlString(); $afterLabelSchema = $field?->getChildSchema($field::AFTER_LABEL_SCHEMA_KEY)?->toHtmlString(); $aboveContentSchema = $field?->getChildSchema($field::ABOVE_CONTENT_SCHEMA_KEY)?->toHtmlString(); $belowContentSchema = $field?->getChildSchema($field::BELOW_CONTENT_SCHEMA_KEY)?->toHtmlString(); $beforeContentSchema = $field?->getChildSchema($field::BEFORE_CONTENT_SCHEMA_KEY)?->toHtmlString(); $afterContentSchema = $field?->getChildSchema($field::AFTER_CONTENT_SCHEMA_KEY)?->toHtmlString(); $aboveErrorMessageSchema = $field?->getChildSchema($field::ABOVE_ERROR_MESSAGE_SCHEMA_KEY)?->toHtmlString(); $belowErrorMessageSchema = $field?->getChildSchema($field::BELOW_ERROR_MESSAGE_SCHEMA_KEY)?->toHtmlString(); $hasError = $hasErrors && (filled($errorMessage) || filled($errorMessages) || (filled($statePath) && ($errors->has($statePath) || ($hasNestedRecursiveValidationRules && $errors->has("{$statePath}.*"))))); if ($hasError && filled($statePath) && blank($errorMessage) && blank($errorMessages)) { if ($shouldShowAllValidationMessages) { $errorMessages = $errors->has($statePath) ? $errors->get($statePath) : ($hasNestedRecursiveValidationRules ? $errors->get("{$statePath}.*") : []); if (count($errorMessages) === 1) { $errorMessage = Arr::first($errorMessages); $errorMessages = []; } } else { $errorMessage = $errors->has($statePath) ? $errors->first($statePath) : ($hasNestedRecursiveValidationRules ? $errors->first("{$statePath}.*") : null); } } @endphp
merge($field?->getExtraFieldWrapperAttributes() ?? [], escape: false) ->class([ 'fi-fo-field', 'fi-fo-field-has-inline-label' => $hasInlineLabel, ]) }} > @if (filled($label) && $labelSrOnly) <{{ $labelTag }} @if ($labelTag === 'label') for="{{ $id }}" @else id="{{ $id }}-label" @endif class="fi-fo-field-label fi-sr-only" > {{ $label }} @endif @if ((filled($label) && (! $labelSrOnly)) || $hasInlineLabel || $aboveLabelSchema || $belowLabelSchema || $beforeLabelSchema || $afterLabelSchema || $labelPrefix || $labelSuffix)
value}" => $hasInlineLabel, ]) > {{ $aboveLabelSchema }}
attributes->get('class') : null, ]) > {{ $beforeLabelSchema }} @if ((filled($label) && (! $labelSrOnly)) || $labelPrefix || $labelSuffix) <{{ $labelTag }} @if ($labelTag === 'label') for="{{ $id }}" @else id="{{ $id }}-label" @endif class="fi-fo-field-label" > {{ $labelPrefix }} @if (filled($label) && (! $labelSrOnly)) {{ $label }}@if ($required && (! $isDisabled))* @endif @endif {{ $labelSuffix }} @endif {{ $afterLabelSchema }}
{{ $belowLabelSchema }}
@endif @if ((! \Filament\Support\is_slot_empty($slot)) || $hasError || $aboveContentSchema || $belowContentSchema || $beforeContentSchema || $afterContentSchema || $aboveErrorMessageSchema || $belowErrorMessageSchema)
{{ $aboveContentSchema }} @if ($beforeContentSchema || $afterContentSchema)
{{ $beforeContentSchema }}
{{ $slot }}
{{ $afterContentSchema }}
@else {{ $slot }} @endif {{ $belowContentSchema }} @if ($hasError) {{ $aboveErrorMessageSchema }} @if (filled($errorMessages)) @elseif ($areHtmlErrorMessagesAllowed)
{!! $errorMessage !!}
@else

{{ $errorMessage }}

@endif {{ $belowErrorMessageSchema }} @endif
@endif