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:
Ümit Tunç
2025-11-01 16:27:35 -03:00
parent ad20ba575a
commit 5fb74384ce
3 changed files with 3 additions and 17 deletions
@@ -11,8 +11,6 @@ class MenuTree extends Page
{
protected static string $resource = PageResource::class;
protected string $view = 'filament.admin.pages.menu-tree';
public function getTitle(): string
{
return __('pages.menu_tree_title');
@@ -36,7 +34,7 @@ class MenuTree extends Page
];
}
protected function getHeaderWidgets(): array
protected function getFooterWidgets(): array
{
return [
PagesMenuWidget::class,
@@ -15,14 +15,11 @@ class PagesMenuWidget extends BaseWidget
protected static int $maxDepth = 4;
protected ?string $treeTitle = null;
protected bool $enableTreeTitle = true;
public function mount(): void
public function getTreeTitle(): string
{
parent::mount();
$this->treeTitle = __('pages.menu_tree_title');
return __('pages.menu_tree_title');
}
protected function getTreeQuery(): Builder