Esempio n. 1
0
 /**
  * @test
  * @expectedException Neos\Form\Exception\TypeDefinitionNotFoundException
  */
 public function getMergedTypeDefinitionThrowsExceptionIfTypeNotFound()
 {
     $supertypeResolver = new SupertypeResolver(array());
     $supertypeResolver->getMergedTypeDefinition('nonExistingType');
 }
Esempio n. 2
0
 /**
  * Create a page with the given $identifier and attach this page to the form.
  *
  * - Create Page object based on the given $typeName
  * - set defaults inside the Page object
  * - attach Page object to this form
  * - return the newly created Page object
  *
  * @param string $identifier Identifier of the new page
  * @param string $typeName Type of the new page
  * @return \Neos\Form\Core\Model\Page the newly created page
  * @throws \Neos\Form\Exception\TypeDefinitionNotFoundException
  * @api
  */
 public function createPage($identifier, $typeName = 'Neos.Form:Page')
 {
     $typeDefinition = $this->formFieldTypeManager->getMergedTypeDefinition($typeName);
     if (!isset($typeDefinition['implementationClassName'])) {
         throw new \Neos\Form\Exception\TypeDefinitionNotFoundException(sprintf('The "implementationClassName" was not set in type definition "%s".', $typeName), 1325689855);
     }
     $implementationClassName = $typeDefinition['implementationClassName'];
     $page = new $implementationClassName($identifier, $typeName);
     if (isset($typeDefinition['label'])) {
         $page->setLabel($typeDefinition['label']);
     }
     if (isset($typeDefinition['rendererClassName'])) {
         $page->setRendererClassName($typeDefinition['rendererClassName']);
     }
     if (isset($typeDefinition['renderingOptions'])) {
         foreach ($typeDefinition['renderingOptions'] as $key => $value) {
             $page->setRenderingOption($key, $value);
         }
     }
     \Neos\Form\Utility\Arrays::assertAllArrayKeysAreValid($typeDefinition, array('implementationClassName', 'label', 'rendererClassName', 'renderingOptions'));
     $this->addPage($page);
     return $page;
 }