Skip to content

Commit

Permalink
Merge pull request #1 from hydephp/update-my-profile-page-configurati…
Browse files Browse the repository at this point in the history
…on-to-support-navigation-groups

Update MyProfile page configuration to support navigation groups
  • Loading branch information
caendesilva authored Jan 5, 2024
2 parents 6440e94 + 3fcaa71 commit 247c5f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ BreezyCore::make()
->myProfile(
shouldRegisterUserMenu: true, // Sets the 'account' link in the panel User Menu (default = true)
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)
slug: 'my-profile' // Sets the slug for the profile page (default = 'my-profile')
)
Expand Down
7 changes: 6 additions & 1 deletion src/BreezyCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,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')
public function myProfile(bool $condition = true, bool $shouldRegisterUserMenu = true, bool $shouldRegisterNavigation = false, bool $hasAvatars = false, string $slug = 'my-profile', ?string $navigationGroup = null)
{
$this->myProfile = get_defined_vars();

Expand Down Expand Up @@ -234,6 +234,11 @@ public function shouldRegisterNavigation(string $key)
return $this->{$key}['shouldRegisterNavigation'];
}

public function getNavigationGroup(string $key)
{
return $this->{$key}['navigationGroup'] ?? null;
}

public function enableTwoFactorAuthentication(bool $condition = true, bool $force = false, string|Closure|array|null $action = TwoFactorPage::class)
{
$this->twoFactorAuthentication = $condition;
Expand Down
5 changes: 5 additions & 0 deletions src/Pages/MyProfilePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public static function shouldRegisterNavigation(): bool
return filament('filament-breezy')->shouldRegisterNavigation('myProfile');
}

public static function getNavigationGroup(): ?string
{
return filament('filament-breezy')->getNavigationGroup('myProfile');
}

public function getRegisteredMyProfileComponents(): array
{
return filament('filament-breezy')->getRegisteredMyProfileComponents();
Expand Down

0 comments on commit 247c5f6

Please sign in to comment.