F
Filament2mo ago
Johan

Translatable Plugin - getLocaleLabelUsing

Am I missing something or should getLocaleLabelUsing return $this?
3 Replies
Azad Furkan ŞAKAR
I dont understand what you mean but it’s a getter function. Why you think it should return “$this”?
Johan
JohanOP2mo ago
In fact it is a sort of setter method:
public function getLocaleLabelUsing(?Closure $callback): void
{
$this->getLocaleLabelUsing = $callback;
}
public function getLocaleLabelUsing(?Closure $callback): void
{
$this->getLocaleLabelUsing = $callback;
}
Right now we can not use the method within the service provider.
SpatieLaravelTranslatablePlugin::make()
->defaultLocales(
array_map(
static fn ($locale) => type($locale)->asString(),
config()->array('app.locales')
)
)
->getLocaleLabelUsing(fn (string $locale, ?string $displayLocale = null): ?string => $locale),
SpatieLaravelTranslatablePlugin::make()
->defaultLocales(
array_map(
static fn ($locale) => type($locale)->asString(),
config()->array('app.locales')
)
)
->getLocaleLabelUsing(fn (string $locale, ?string $displayLocale = null): ?string => $locale),
Because it needs to return itself, which it doenst.
Johan
JohanOP2mo ago
GitHub
Make getLocaleLabelUsing usable in service provider by johanmolen ·...
Right now we can not do the following within the panel service providers: public function panel(Panel $panel): Panel { return $panel ->plugins([ S...

Did you find this page helpful?