filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.1k stars 2.83k forks source link

Please stop using Str::headline in Resource class or alow some kind of disable flag as is breaking the bread crumbs and labels #9682

Closed quasiperfect closed 9 months ago

quasiperfect commented 10 months ago

Package

filament/filament

Package Version

v3.0.0

Laravel Version

v10.0.0

Livewire Version

No response

PHP Version

PHP 8.1.10

Problem description

For example if i use the string 'E-mailuri blocate' as label i expect to get that string not 277732367-d8c8cc9f-a8f9-44d8-892d-7a285315900b

Expected behavior

Don't change my strings unless i say so by a config or some other method

Steps to reproduce

Use in any resource

public static function getModelLabel(): string
{
    return 'My-custom label';
}

public static function getPluralModelLabel(): string
{
    return 'My-custom label';
}

Reproduction repository

https://github.com/filamentphp/demo

Relevant log output

No response

malle-pietje commented 10 months ago

The easiest approach would be to have a private property for the breadcrumb string like with the navigation label and heading where we can override the default behavior which probably works nicely in 80% of the cases. For the other 20% some level of control would be great.

zepfietje commented 10 months ago

The breadcrumb can be customized separately using the $breadcrumb property on a resource or page, or the getBreadcrumb() method.

I do think however that maybe we shouldn't use the headline() method, but use ucfirst() instead, @danharrin.

danharrin commented 10 months ago

The idea is that each word is capitalised based on title case, not just the first

And yes, this can easily be overridden in the breadcrumb, page titles etc

quasiperfect commented 10 months ago

@zepfietje @danharrin if you have a ton of resources is not that fun to do. Or if you have some plugin installed that doesn't allow you to extend the resource etc. So please provide a method to turn off this behavior for people that doesn't need/want it (maybe it makes a lot of sense for english language but for some other languages that is a problem).

Also the - are replaced with spaces.

Thanks for your time and understanding.

danharrin commented 10 months ago

It is not as simple as you are making it sound, the label is used in other places, not just this.

I will think about adding a new property where you can set the breadcrumb and page titles at the same time.