Open flatcapco opened 4 years ago
Thanks for reporting 👍
Do you happen to know if the same happens with onlyOnIndex
and onlyOnDetail
?
I won't behave with any of the "hide" options. I've opened a ticket for it but then I've noticed this one. I suppose it can be handled here.
Same issue here
I have pushed a partial fix for this - now fields that should be hidden on the detail page are indeed hidden. But we must apply the same fix for the other pages - sadly I don't have time to handle that today. It should be fairly similar to what I have done though.
public function fields(Request $request) {
$field_action = substr($request->getPathInfo(), strrpos($request->getPathInfo(), '/')+1);
$fields = array(
ID::make()->sortable(),
Media::make('Banners', 'banners'),
NovaTinyMCE::make('Description'),
);
if ($field_action == "update-fields" || $field_action == "creation-fields") {
return $fields = array_merge($fields, array(
Flexible::make('Program')
->addLayout('Day', 'day', [
DateTime::make('Event Date', 'event_begin')
->resolveUsing(function ($date) {
return Carbon::parse($date);
})
->format('DD MMM Y hh:mm:ss')
->required(),
])
));
} else {
return $fields;
}
}
same issue here
Ran into this issue due to Nova's only way to Select::make()->displayUsing() with HTML is: https://github.com/laravel/nova-issues/issues/644#issuecomment-458807921
Alternative solution might be to support
in addition to fields() in layouts
https://nova.laravel.com/docs/3.0/resources/fields.html#dynamic-field-methods
It appears that novas field conditional view logic isn't working when a field is called from within a Layout:
Calling layout:
Field within this layout:
Text::make('Name')->onlyOnForms(),