-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow page headers to be customised (#1573)
Adds a new trait to allow page headers to be customised. --------- Co-authored-by: glennjacobs <glennjacobs@users.noreply.github.com>
- Loading branch information
1 parent
3c954f8
commit 3c87ba0
Showing
7 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/admin/src/Support/Pages/Concerns/ExtendsHeadings.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Lunar\Admin\Support\Pages\Concerns; | ||
|
||
use Illuminate\Contracts\Support\Htmlable; | ||
|
||
trait ExtendsHeadings | ||
{ | ||
public function getDefaultHeading(): string | ||
{ | ||
return $this->heading ?? $this->getTitle(); | ||
} | ||
|
||
public function getHeading(): string|Htmlable | ||
{ | ||
return $this->callLunarHook('heading', $this->getDefaultHeading()); | ||
} | ||
|
||
public function getDefaultSubheading(): ?string | ||
{ | ||
return $this->subheading; | ||
} | ||
|
||
public function getSubheading(): string|Htmlable|null | ||
{ | ||
return $this->callLunarHook('subHeading', $this->getDefaultSubheading()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters