code: private function getRootForm(FormInterface $form)
      {
          if ($form->getParent() === NULL) {
              return $form;
          } else {
              return $this->getRootForm($form->getParent());
          }
      }
docs: Return the root form (i.e. produced from CustomFieldsGroupType::getForm)
  
  @param FormInterface $form
  @return FormInterface