Repeater Field Type: How to change input view
Created 6 years ago by williamAnomaly\RepeaterFieldType\RepeaterFieldType has $inputView
that i would like to change into a custom one. How do i change this for a specific repeater?
The form requires a hook - no auto-detection: https://github.com/anomalylabs/repeater-field_type/blob/1.3/src/RepeaterFieldType.php#L252
Code me an example and invoice me @ryanthompson 😄
Try just defining it on your model in question (related config on the field) - this way it won't hit the hook defined in the repeater FT. This would be considered explicit definition of the hook handler. I think adding your own hook pry didn't work cause it fired first / the core one last and you ended up "not overriding anything".. this is more explicitly forced into the FT.
public function newRepeaterFieldTypeFormBuilder() {
return app(MyCustomRepeaterFormBuilder::class)
}
You can also make your own form builder AS LONG AS you've bound your entry model properly (so it's located within your addon): https://github.com/anomalylabs/repeater-field_type/blob/1.3/src/RepeaterFieldTypeServiceProvider.php#L57 This would be considered auto-detection.
<?php namespace Example\CatsModule\Cat\Support\RepeaterFieldType;
class FormBuilder extends \Anomaly\Streams\Platform\Ui\Form\FormBuilder
{
// Normal form builder stuff
}
Note that unlike the table builders it doesn't have to extend anything in particular.
I might as well ask how to change the wrapper view as well. Because i tried to add
Support/RepeaterFieldType/FormBuilder
and define it within$options
. But it doesn't look like it is automatically picked up.