/** * Try to find (recursively) if there is a field to remove from the content type * * @param array $formArray * @param FieldType $fieldType */ private function removeField(array $formArray, FieldType $fieldType) { if (array_key_exists('remove', $formArray)) { $fieldType->setDeleted(true); $this->addFlash('notice', 'The field ' . $fieldType->getName() . ' has been prepared to be removed'); return true; } else { /** @var FieldType $child */ foreach ($fieldType->getChildren() as $child) { if (!$child->getDeleted() && $this->removeField($formArray['ems_' . $child->getName()], $child)) { return true; } } } return false; }