It seems there is no way apart from overriding the views/bread/read.blade.php template to define the view/HTML for custom form fields.
Even if I create the form field handler and the view as instructed on https://voyager.readme.io/v1.0/docs/adding-custom-formfields, that view is still not used when I browse a table containing the custom field, or view its records.
It looks like views/bread/read.blade.php has all the HTML output hard-coded, and any non-original field types are just output as text
class="form-control special-type-of-numbers");Yes, that is because a Formfield is an input, not an output for read
Yes, that makes sense. Still, viewing is very closely related to editing and the whole entity management (R in CRUD, R and B in BREAD), so being able to customise the view along with customising the edit form and saving is quite important.
This would be a feature suggestion then.
Which is already in the making ;)
It should also be added that the docs don't mention this necessary step in https://docs.laravelvoyager.com/customization/adding-custom-formfields and that the docs should probably be updated to inform people of this sooner rather than later.
Was this implemented ? @emptynick docs doesnt works.
Well yes, 2 years ago round about
@emptynick and theres any docs on how to do it anywhere ?
Current adding custom formfields docs talks about the same stuff and theres no news about replacing the output on read.blades
@emptynick in your commit here:
https://github.com/the-control-group/voyager/commit/ed8cd38bdc78a8669150b7903116cd01ae827965
You have added that "/customization/overriding-formfields" doc, and it is not online anywhere so wondering if thats the way to go or what.
I have tried to add "view" to options but with no results, scraped code to figure out how it should work but the "$row->details->view" in the read.blade seems coming from Bread conf not the customformfield class.
I need to replace all views on all read.blades for a customformfield.
Could you help please with a clear example on how to make this work?
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
Which is already in the making ;)