Hi,
The input part is working fine, and gets passed to a form the user will use to confirm the deletion. A hook is ran when confirmation form is submitted, but frankly I'm very much stuck with actually deleting the repeater item part.
$forms->addHookBefore('FormBuilderProcessor::saveForm', function($event) {
$sanitizer = wire('sanitizer');
$page = wire('page');
$pages = wire('pages');
$form = $event->arguments(0);
if($form->name != 'removesubmission' && $page->template != 'removeSubmission') return;
$removeKey = $form->getChildByName('remove_deletekey')->value;
$eventPage = $pages->get('template=event, eventParticipant.eventParticipant_deletekey='.$removeKey);
if (!empty($eventPage->id)) {
$eventPage->of(false);
$removeParticipant = $eventPage->eventParticipant->find("eventParticipant_deletekey=".$removeKey);
$eventPage->eventParticipant->remove($removeParticipant);
$eventPage->save();
}
});
There's lots of stuff missing still. But right now I'm just trying to kill the repeater (eventParticipant) item.
So a deletekey gets passed from input into the confirmation form. This is picked up in the hook ($removeKey). The correct page and repeater item are found. But how do you actually delete the item? I've been looking into it for several hours now and no luck. The form runs, no errors, but nothing happens either.