Skip to content

Commit 3ddaff5

Browse files
committed
Improve route options
1 parent 1482561 commit 3ddaff5

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/Filament/Form/Forms/MenuItemForm.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Statikbe\FilamentFlexibleContentBlockPages\Filament\Form\Fields\Types\RouteMenuItemType;
1414
use Statikbe\FilamentFlexibleContentBlockPages\Filament\Form\Fields\Types\UrlMenuItemType;
1515
use Statikbe\FilamentFlexibleContentBlockPages\Models\Contracts\HasMenuLabel;
16+
use Statikbe\FilamentFlexibleContentBlocks\FilamentFlexibleBlocksConfig;
1617

1718
class MenuItemForm
1819
{
@@ -166,7 +167,7 @@ protected static function getRouteField(): Select
166167
{
167168
return Select::make(static::FIELD_ROUTE)
168169
->label(flexiblePagesTrans('menu_items.form.route_lbl'))
169-
->options(static::getRouteOptions())
170+
->options(FilamentFlexibleBlocksConfig::getLinkRoutes())
170171
->searchable()
171172
->required()
172173
->visible(fn (Get $get): bool => static::isRouteType($get(static::FIELD_LINK_TYPE)))
@@ -283,10 +284,4 @@ protected static function isRouteType(?string $linkType): bool
283284
return $type ? $type->isRouteType() : false;
284285
}
285286

286-
protected static function getRouteOptions(): array
287-
{
288-
$routeType = new RouteMenuItemType;
289-
290-
return $routeType->getRouteOptions();
291-
}
292287
}

src/Models/MenuItem.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ class MenuItem extends Model
2020

2121
protected $fillable = [
2222
'menu_id',
23+
'link_type',
2324
'label',
2425
'url',
26+
'route',
2527
'linkable_type',
2628
'linkable_id',
2729
'target',

0 commit comments

Comments
 (0)