How to change a label for a field, in view page?
I have a Main Resource file, that defines the form like so (See attached image).
I am needing to change the field label only when viewing a record, based on a
if
condition on what the value of this record is. For example:
If value is FR
then the label should be Company Registration France
.
How can I achieve so in the View Page file?
<?php
namespace App\Filament\Resources\AllClientsResource\Pages;
use App\Filament\Resources\AllClientsResource;
use Filament\Resources\Pages\ViewRecord;
class ViewClient extends ViewRecord
{
protected static string $resource = AllClientsResource::class;
protected function mutateFormDataBeforeFill(array $data): array
{
return $data;
}
}
4 Replies
I guess you could do something like that:
π€
Thanks @dissto !
Thank you π