Jonathan Lahijani Posted December 5, 2023 Share Posted December 5, 2023 I'm trying to add a markup field to a repeater item. I would think to use ProcessPageEdit::buildFormContent however that only executes when a page being edited is loaded, not when a repeater item is expanded. What is the correct hook that would allow me to use the form API and insert a markup field somewhere in the repeater item? Link to comment Share on other sites More sharing options...
szabesz Posted December 5, 2023 Share Posted December 5, 2023 Hello, Maybe this can be a good starting point: https://processwire.com/talk/topic/21756-field-access-on-runtime/?do=findComment&comment=187094 Link to comment Share on other sites More sharing options...
elabx Posted December 5, 2023 Share Posted December 5, 2023 I would try InputfieldWrapper::render since the repeater items are wrappers themselves ? but not sure super. 1 Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted April 30 Author Share Posted April 30 On 12/5/2023 at 7:46 AM, elabx said: I would try InputfieldWrapper::render since the repeater items are wrappers themselves ? but not sure super. As far as I can tell, that's the way to do it. Assuming your repeater field is called 'my_repeater_field' and it contains a field called 'foo' that you want to add a make-shift markup field above, here's what you'd do: $wire->addHookAfter('InputfieldWrapper::render', function(HookEvent $event) { if(!$event->object->children->count) return; if($event->object->children[0]->name!="my_repeater_field") return; $event->return = str_replace( "<li class='Inputfield InputfieldText Inputfield_foo_repeater", " <li class='Inputfield'> <label class='InputfieldHeader'> my custom repeater markup field </label> <div class='InputfieldContent'> content goes here </div> </li> <li class='Inputfield InputfieldText Inputfield_foo_repeater", $event->return ); }); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now