/** * Recurse the given form and return the notifications for it and all of its subforms * * @param Form $form The form to recurse * * @return array */ protected function recurseForm(Form $form) { $notifications = $form->getNotifications(); foreach ($form->getSubForms() as $subForm) { $notifications = $notifications + $this->recurseForm($subForm); } return $notifications; }
/** * Recurse the given form and return the notifications for it and all of its subforms * * @param Form $form The form to recurse * * @return array */ protected function recurseForm(Form $form) { $notifications = $form->getNotifications(); foreach ($form->getSubForms() as $subForm) { foreach ($this->recurseForm($subForm) as $type => $messages) { foreach ($messages as $message) { $notifications[$type][] = $message; } } } return $notifications; }