Bypass automatic case alterations for labels

Hi. I can't figure out how to bypass the case alterations that are happening for resource names. For example
public static ?string $label = 'VAT Invoices';
public static ?string $label = 'VAT Invoices';
is automatically changed to 'Vat Invoices'.
7 Replies
binaryfire
binaryfireOP15mo ago
Spaces are being automatically injected between letters for things like 'FAQ' too.
binaryfire
binaryfireOP15mo ago
Found it: https://github.com/filamentphp/filament/blob/c806a27f7eac00a4305b0187beba6d30d4312eb4/packages/panels/src/Resources/Resource.php#L737 So this works:
protected static ?string $navigationLabel = 'VAT Invoices';
protected static ?string $navigationLabel = 'VAT Invoices';
trovster
trovster15mo ago
That works for the navigation, but not the resource title.
binaryfire
binaryfireOP15mo ago
Yeah, I've changed it separately on each page by overriding getTitle, and have set $label, $breadcrumb and $navigationLabel in the resource.
trovster
trovster15mo ago
You don't need to override the getTitle() method, just set protected static ?string $title on the Manage Page. I have protected static ?string $modelLabel not $label on my resources. Aha
/**
* @deprecated Use `$modelLabel` instead.
*/
protected static ?string $label = null;

protected static ?string $modelLabel = null;
/**
* @deprecated Use `$modelLabel` instead.
*/
protected static ?string $label = null;

protected static ?string $modelLabel = null;
binaryfire
binaryfireOP15mo ago
Thanks. I think I was looking at the v2 docs for that
Want results from more Discord servers?
Add your server