/** * Gets a specific formular. * * This formular will be created upon the first retrievement. * If created, the formular gets passed the formular parameters set in this container. * * @see Container::getForm * * @param string $key * @param bool $asInstance if false, the specification array is returned. * * @return Container|null|\Zend\Form\FormInterface|array * @throws \UnexpectedValueException */ public function getForm($key, $asInstance = true) { $form = parent::getForm($key, $asInstance); /* * We must check here, if a lazy loaded top level form is an * instance of Container. */ if ($asInstance && false === strpos($key, '.') && (!$form instanceof Container || !$form->getLabel())) { throw new \UnexpectedValueException(sprintf('The registered form with key "%s" is not an instance of \\Core\\Form\\Container or does not have a label.', $key)); } return $form; }