Files
nutzwerte_fi4/app/Filament/Clusters/Administration/Textblocks/Schemas/TextblockForm.php
T
2026-05-13 10:10:48 +02:00

101 lines
5.4 KiB
PHP

<?php
namespace App\Filament\Clusters\Administration\Textblocks\Schemas;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Schemas\Schema;
class TextblockForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Tabs::make('Tabs')
->tabs([
Tab::make('Inhaltselement')
->icon('phosphor-textbox')
->schema([
TextInput::make('name')
->label('Element Name')
->afterLabel([
'Wird im Gutachten nicht verwendet, dient nur zur Erkennen des Inhaltselements.',
])
->required(),
RichEditor::make('textblock')
->label('Abschnitt A')
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
])->floatingToolbars([
'paragraph' => [
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
],
'heading' => [
'h1', 'h2', 'h3',
],
'table' => [
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
'tableMergeCells', 'tableSplitCell',
'tableToggleHeaderRow',
'tableDelete',
],
]),
RichEditor::make('textblock2')
->label('Abschnitt B')
->afterLabel([
'Textblock uner der Überschrift.',
])
->belowContent([
'Dieses Feld kann auch leer bleiben. Sollten im selben Punkt des Inhaltsvereichnisses auch eine Tabelle verwendet werden, dann wird dieser Text nach dieser angezeigt.',
])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
])->floatingToolbars([
'paragraph' => [
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
],
'heading' => [
'h1', 'h2', 'h3',
],
'table' => [
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
'tableMergeCells', 'tableSplitCell',
'tableToggleHeaderRow',
'tableDelete',
],
]),
]),
Tab::make('Benutzer Hilfe')
->icon('phosphor-chat-text')
->schema([
TextInput::make('hilfe_titel')
->aboveLabel([
'Wird dem Benutzer bei der Bearbeitung dieses Inhaltselements angezeigt.',
])
->label('Überschrift')
->columnSpanFull(),
Textarea::make('hilfe_description')
->label('Text'),
FileUpload::make('hilfe_image')
->image()
->label('Bild')
->disk('public')
->maxSize(3072) // 3MB limit
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
->directory('gutachten_hilfe')
->visibility('public')
->columnSpanFull(),
]),
]),
])->columns(1);
}
}