Initial commit
This commit is contained in:
66
app/Filament/Resources/Links/Schemas/LinkForm.php
Normal file
66
app/Filament/Resources/Links/Schemas/LinkForm.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Links\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\Builder\Block;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class LinkForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make()
|
||||
->schema([
|
||||
Builder::make('links')
|
||||
->label('Przyciski')
|
||||
->addActionLabel('Dodaj przycisk')
|
||||
->collapsible()
|
||||
->collapsed()
|
||||
->reorderable()
|
||||
->blocks([
|
||||
Block::make('link')
|
||||
->label(function (?array $state): string {
|
||||
if ($state === null) {
|
||||
return 'Odnośnik';
|
||||
}
|
||||
|
||||
return $state['name'] ?? 'Odnośnik';
|
||||
})
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Nazwa')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->label('Ikona (FontAwesome)')
|
||||
->required(),
|
||||
Select::make('btn_style')
|
||||
->label('Styl przycisku')
|
||||
->options([
|
||||
'primary' => 'Pomarańczowy',
|
||||
'secondary' => 'Szary',
|
||||
])
|
||||
->default('primary')
|
||||
->required(),
|
||||
TextInput::make('link')
|
||||
->label('Link')
|
||||
->required(),
|
||||
Toggle::make('external')
|
||||
->label('Zewnętrzny link')
|
||||
->required(),
|
||||
Toggle::make('new_tab')
|
||||
->label('Otwieraj w nowym oknie')
|
||||
->required(),
|
||||
])
|
||||
->columns(2),
|
||||
])
|
||||
])
|
||||
])->statePath('data');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user