F
Filamentβ€’14mo ago
harps

Resource view heading html

Is there any way to add html into the heading of resource view. II want to get something like <h1>Batch <span class="text-primary">AUDITS_05_10_23</span></h1> But returning html in the getHeading() function just prints the span mark up.
public function getHeading(): string
{
// Use the field batch_name from the resource as the page heading.
$heading = 'Batch <span class="text-primary">' . $this->record->batch_name . '</span>';
return new HtmlString($heading);
}
public function getHeading(): string
{
// Use the field batch_name from the resource as the page heading.
$heading = 'Batch <span class="text-primary">' . $this->record->batch_name . '</span>';
return new HtmlString($heading);
}
Cheers Dan
Solution:
Return a new HtmlString('')
Jump to solution
5 Replies
Solution
Dennis Koch
Dennis Kochβ€’14mo ago
Return a new HtmlString('')
harps
harpsOPβ€’14mo ago
no that doesn't seem to work πŸ€” Sorry fixed it, the rturn type was String instead of htmlString
Dennis Koch
Dennis Kochβ€’14mo ago
Just wanted to point that out πŸ˜…
harps
harpsOPβ€’14mo ago
public function getHeading(): HtmlString
{
// Use the field batch_name from the resource as the page heading.
$heading = 'Batch <span class="text-primary">' . $this->record->batch_name . '</span>';
return new HtmlString($heading);
}
public function getHeading(): HtmlString
{
// Use the field batch_name from the resource as the page heading.
$heading = 'Batch <span class="text-primary">' . $this->record->batch_name . '</span>';
return new HtmlString($heading);
}
this works
Dennis Koch
Dennis Kochβ€’14mo ago
πŸ˜… Good, you fixed it πŸ˜…
Want results from more Discord servers?
Add your server