Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions resources/lang/en/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
'working title' => 'Working Title',
'identifier' => 'Identifier',
'description' => 'Description',
'depth' => 'Depth',
'build menu' => 'Build menu',
'label' => 'Label',
'translated link' => 'Translated link',
'override translation link' => 'If you want to override the link for this translation, you can do so here.',
'online' => 'Online',
];
13 changes: 13 additions & 0 deletions resources/lang/nl/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
'working title' => 'Werktitel',
'identifier' => 'Identificatie',
'description' => 'Beschrijving',
'depth' => 'Diepte',
'build menu' => 'Menu opbouwen',
'link' => 'Link',
'label' => 'Label',
'override translation link' => 'Als u de link voor deze vertaling wilt overschrijven, kunt u dat hier doen.',
'online' => 'Online',
];
11 changes: 11 additions & 0 deletions resources/lang/nl/menu-builder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return [
'depth issue warning' => 'Sommige van uw menu-items zijn te diep genest, waardoor ze niet zichtbaar zijn op de front-end.',
'add menu item' => 'Nieuw item toevoegen',
'edit menu item' => 'Wijzig item',
'delete menu item' => 'Verwijder item',
'successfully created' => 'Succesvol aangemaakt',
'successfully updated' => 'Succesvol bijgewerkt',
'successfully sorted' => 'Succesvol gesorteerd',
];
2 changes: 2 additions & 0 deletions src/Filament/Pages/MenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,18 @@

return [
'working_title' => $menuItem->working_title,
'type' => $menuItem->type,

Check failure on line 69 in src/Filament/Pages/MenuBuilder.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property Codedor\FilamentMenu\Models\MenuItem|Illuminate\Database\Eloquent\Collection<int, Codedor\FilamentMenu\Models\MenuItem>::$type.
...$menuItem->data ?? [],
];
})
->form(fn () => [
TextInput::make('working_title')
->label(__('filament-menu::admin.working title'))
->required()
->maxLength(255),

Select::make('type')
->label(__('filament-menu::admin.type'))
->options($types)
->required()
->reactive(),
Expand Down
13 changes: 11 additions & 2 deletions src/Filament/Resources/MenuResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,23 @@ public static function form(Form $form): Form
return $form->schema([
Components\Grid::make(1)->schema([
Components\TextInput::make('working_title')
->label(__('filament-menu::admin.working title'))
->autofocus()
->unique(ignorable: fn ($record) => $record)
->required(),

Components\TextInput::make('identifier')
->label(__('filament-menu::admin.identifier'))
->unique(ignorable: fn ($record) => $record)
->hidden(fn () => ! is_superadmin())
->required(),

Components\Textarea::make('description')
->label(__('filament-menu::admin.description'))
->rows(3),

Components\TextInput::make('depth')
->label(__('filament-menu::admin.depth'))
->hidden(fn () => ! is_superadmin())
->default(1)
->minValue(1)
Expand All @@ -49,18 +53,23 @@ public static function table(Table $table): Table
{
return $table
->columns([
Columns\TextColumn::make('working_title'),
Columns\TextColumn::make('working_title')
->label(__('filament-menu::admin.working title')),

Columns\TextColumn::make('identifier')
->label(__('filament-menu::admin.identifier'))
->hidden(fn () => ! is_superadmin()),

Columns\TextColumn::make('description')
->label(__('filament-menu::admin.description'))
->hidden(fn () => is_superadmin()),

Columns\TextColumn::make('depth'),
Columns\TextColumn::make('depth')
->label(__('filament-menu::admin.depth')),
])
->actions([
Tables\Actions\Action::make('build-menu')
->label(__('filament-menu::admin.build menu'))
->icon('heroicon-o-document-text')
->url(fn (Menu $record): string => "menus/{$record->id}/builder"),

Expand Down
4 changes: 3 additions & 1 deletion src/NavigationElements/LinkPickerElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ public function schema(): array
])
->translatableFields(fn () => [
TextInput::make('label')
->label(__('filament-menu::admin.label'))
->required(fn (Get $get) => $get('online')),

LinkPickerInput::make('translated_link')
->helperText('If you want to override the link for this translation, you can do so here.'),
->label(__('filament-menu::admin.translated link'))
->helperText(__('filament-menu::admin.override translation link')),

Checkbox::make('online'), // TODO: Toggle doesn't work on create ?
]),
Expand Down
Loading