Skip to content

Commit

Permalink
Merge pull request #406 from intrepidws/customize-user-menu-link
Browse files Browse the repository at this point in the history
Allow User Menu Link Customization
  • Loading branch information
jeffgreco13 authored Jan 14, 2025
2 parents 31e3c27 + acf5add commit 1440856
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -91,6 +91,7 @@ Enable the My Profile page with configuration options.
BreezyCore::make()
->myProfile(
shouldRegisterUserMenu: true, // Sets the 'account' link in the panel User Menu (default = true)
userMenuLabel: 'My Profile', // Customizes the 'account' link label in the panel User Menu (default = null)
shouldRegisterNavigation: false, // Adds a main navigation item for the My Profile page (default = false)
navigationGroup: 'Settings', // Sets the navigation group for the My Profile page (default = null)
hasAvatars: false, // Enables the avatar upload form component (default = false)
6 changes: 3 additions & 3 deletions src/BreezyCore.php
Original file line number Diff line number Diff line change
@@ -125,12 +125,12 @@ public function boot(Panel $panel): void
$tenantId = request()->route()->parameter('tenant');
if ($tenantId && $tenant = app($panel->getTenantModel())::where($panel->getTenantSlugAttribute() ?? 'id', $tenantId)->first()) {
$panel->userMenuItems([
'account' => MenuItem::make()->url($this->getMyProfilePageClass()::getUrl(panel: $panel->getId(), tenant: $tenant)),
'account' => MenuItem::make()->url($this->getMyProfilePageClass()::getUrl(panel: $panel->getId(), tenant: $tenant))->label($this->myProfile['userMenuLabel']),
]);
}
} else {
$panel->userMenuItems([
'account' => MenuItem::make()->url($this->getMyProfilePageClass()::getUrl()),
'account' => MenuItem::make()->url($this->getMyProfilePageClass()::getUrl())->label($this->myProfile['userMenuLabel']),
]);
}
}
@@ -147,7 +147,7 @@ public function getCurrentPanel()
return Filament::getCurrentPanel();
}

public function myProfile(bool $condition = true, bool $shouldRegisterUserMenu = true, bool $shouldRegisterNavigation = false, bool $hasAvatars = false, string $slug = 'my-profile', ?string $navigationGroup = null)
public function myProfile(bool $condition = true, bool $shouldRegisterUserMenu = true, bool $shouldRegisterNavigation = false, bool $hasAvatars = false, string $slug = 'my-profile', ?string $navigationGroup = null, ?string $userMenuLabel = null)
{
$this->myProfile = get_defined_vars();

0 comments on commit 1440856

Please sign in to comment.