F
Filament16mo ago
Abi

How do I fix the label on the navigation and the breadcrumb?

I want the label on the navigation and the breadcrumb to say "FAQ's" instead of "F A Qs". Here is what I have tried so far
protected static ?string $modelLabel = 'FAQ';

protected static ?string $pluralModelLabel = 'FAQs';

protected static ?string $label = 'FAQ';

protected static ?string $pluralLabel = 'FAQ\'s';
protected static ?string $modelLabel = 'FAQ';

protected static ?string $pluralModelLabel = 'FAQs';

protected static ?string $label = 'FAQ';

protected static ?string $pluralLabel = 'FAQ\'s';
14 Replies
Abi
AbiOP16mo ago
OK i tried these additionallly
protected static ?string $navigationLabel = 'FAQ\'s';

protected static ?string $breadcrumb = 'FAQ\'s';
protected static ?string $navigationLabel = 'FAQ\'s';

protected static ?string $breadcrumb = 'FAQ\'s';
but there is still the resource header that doesn't show correctly.
awcodes
awcodes16mo ago
Resource header is probably ‘title’. If you override the model label method instead of the property you probably won’t have to set all these properties separately.
Abi
AbiOP16mo ago
that is what I thought, but that did not help. Here is what I tried
public static function getModelLabel(): string
{
return 'FAQ';
}

public static function getPluralModelLabel(): string
{
return 'FAQ\'s';
}
public static function getModelLabel(): string
{
return 'FAQ';
}

public static function getPluralModelLabel(): string
{
return 'FAQ\'s';
}
and here is the result
awcodes
awcodes16mo ago
Hmm. Ok. ‘Title’ should still solve your page header then.
Abi
AbiOP16mo ago
what do you mean by title? @awcodes ^
awcodes
awcodes16mo ago
Should be a title property too on the resource. Or on the individual resource pages. Pretty sure those should be based on the labels though.
Abi
AbiOP16mo ago
ok, I have to do this on each individual page to fix the title on the resource I had to add
protected static ?string $navigationLabel = 'FAQ\'s';

protected static ?string $breadcrumb = 'FAQ\'s';
protected static ?string $navigationLabel = 'FAQ\'s';

protected static ?string $breadcrumb = 'FAQ\'s';
and on each other page I had to set the title
public static ?string $title = 'FAQ\'s';
public static ?string $title = 'FAQ\'s';
awcodes
awcodes16mo ago
Doesn’t sound right to me. I’m surprised the model label methods don’t address that.
Abi
AbiOP16mo ago
ya, setting the modelLabel only fixed the buttons/actions
awcodes
awcodes16mo ago
Yep. Looking at the code now. Title is on the base page and doesn’t reference the resource. Which makes since because the title could be different for Edit, Create, View and List. They are actually referencing the model label but the titles are wrapped in Str::headline() so you’ll have to override them on each page. Sorry.
SOIXT
SOIXT16mo ago
At least we know this I need it as well for FAQs 😄
awcodes
awcodes16mo ago
I’m sure a lot of people have this problem with FAQs. 😅
Abi
AbiOP16mo ago
🙂
awcodes
awcodes16mo ago
The string helper in Laravel always assumes that capital letters are new words, so it adds spaces. If you add the periods like an actual acronym should be grammatically it’d probably work. But that looks almost worse.
Want results from more Discord servers?
Add your server