Refactor MenuTree page and PagesMenuWidget: Removed the view property from MenuTree, updated header widget method to footer widget method, and eliminated the menu-tree Blade view file. Enhanced tree title handling in PagesMenuWidget by introducing a dedicated method for retrieving the title using localization.
This commit is contained in:
@@ -11,8 +11,6 @@ class MenuTree extends Page
|
|||||||
{
|
{
|
||||||
protected static string $resource = PageResource::class;
|
protected static string $resource = PageResource::class;
|
||||||
|
|
||||||
protected string $view = 'filament.admin.pages.menu-tree';
|
|
||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return __('pages.menu_tree_title');
|
return __('pages.menu_tree_title');
|
||||||
@@ -36,7 +34,7 @@ class MenuTree extends Page
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getHeaderWidgets(): array
|
protected function getFooterWidgets(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
PagesMenuWidget::class,
|
PagesMenuWidget::class,
|
||||||
|
|||||||
@@ -15,14 +15,11 @@ class PagesMenuWidget extends BaseWidget
|
|||||||
|
|
||||||
protected static int $maxDepth = 4;
|
protected static int $maxDepth = 4;
|
||||||
|
|
||||||
protected ?string $treeTitle = null;
|
|
||||||
|
|
||||||
protected bool $enableTreeTitle = true;
|
protected bool $enableTreeTitle = true;
|
||||||
|
|
||||||
public function mount(): void
|
public function getTreeTitle(): string
|
||||||
{
|
{
|
||||||
parent::mount();
|
return __('pages.menu_tree_title');
|
||||||
$this->treeTitle = __('pages.menu_tree_title');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTreeQuery(): Builder
|
protected function getTreeQuery(): Builder
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<x-filament-panels::page>
|
|
||||||
@if ($this->hasHeaderWidgets())
|
|
||||||
<x-filament-widgets::widgets
|
|
||||||
:widgets="$this->getHeaderWidgets()"
|
|
||||||
:columns="$this->getHeaderWidgetsColumns()"
|
|
||||||
/>
|
|
||||||
@endif
|
|
||||||
</x-filament-panels::page>
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user