getDeclaredSuperTypes() public method

Note: NULL values are skipped since they are used only internally.
public getDeclaredSuperTypes ( ) : array
return array
コード例 #1
0
 /**
  * @test
  */
 public function nodeTypesCanHaveAnyNumberOfSuperTypes()
 {
     $baseType = new NodeType('Neos.ContentRepository:Base', array(), array());
     $folderType = new NodeType('Neos.ContentRepository.Testing:Document', array($baseType), array());
     $hideableNodeType = new NodeType('Neos.ContentRepository.Testing:HideableContent', array(), array());
     $pageType = new NodeType('Neos.ContentRepository.Testing:Page', array($folderType, $hideableNodeType), array());
     $this->assertEquals(array($folderType, $hideableNodeType), $pageType->getDeclaredSuperTypes());
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository.Testing:Page'));
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository.Testing:HideableContent'));
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository.Testing:Document'));
     $this->assertTrue($pageType->isOfType('Neos.ContentRepository:Base'));
     $this->assertFalse($pageType->isOfType('Neos.ContentRepository:Exotic'));
 }
コード例 #2
0
 /**
  * This method traverses the given node type to find the first super type that matches the constraint node type.
  * In case the hierarchy has more than one way of finding a path to the node type it's not taken into account,
  * since the first matched is returned. This is accepted on purpose for performance reasons and due to the fact
  * that such hierarchies should be avoided.
  *
  * @param NodeType $currentNodeType
  * @param string $constraintNodeTypeName
  * @param integer $distance
  * @return integer or NULL if no NodeType matched
  */
 protected function traverseSuperTypes(NodeType $currentNodeType, $constraintNodeTypeName, $distance)
 {
     if ($currentNodeType->getName() === $constraintNodeTypeName) {
         return $distance;
     }
     $distance++;
     foreach ($currentNodeType->getDeclaredSuperTypes() as $superType) {
         $result = $this->traverseSuperTypes($superType, $constraintNodeTypeName, $distance);
         if ($result !== null) {
             return $result;
         }
     }
     return null;
 }
コード例 #3
0
 /**
  * @param string $nodeTypeName
  * @param NodeType $nodeType
  * @return void
  */
 protected function readNodeTypeConfiguration($nodeTypeName, NodeType $nodeType)
 {
     $nodeTypeConfiguration = $nodeType->getFullConfiguration();
     $this->superTypeConfiguration['typo3:' . $nodeTypeName] = array();
     /** @var NodeType $superType */
     foreach ($nodeType->getDeclaredSuperTypes() as $superType) {
         $this->superTypeConfiguration['typo3:' . $nodeTypeName][] = 'typo3:' . $superType->getName();
     }
     $nodeTypeProperties = array();
     if (isset($nodeTypeConfiguration['properties'])) {
         foreach ($nodeTypeConfiguration['properties'] as $property => $propertyConfiguration) {
             // TODO Make sure we can configure the range for all multi column elements to define what types a column may contain
             $this->addProperty('typo3:' . $nodeTypeName, 'typo3:' . $property, $propertyConfiguration);
             $nodeTypeProperties[] = 'typo3:' . $property;
         }
     }
     $metadata = array();
     $metaDataPropertyIndexes = array('ui');
     foreach ($metaDataPropertyIndexes as $propertyName) {
         if (isset($nodeTypeConfiguration[$propertyName])) {
             $metadata[$propertyName] = $nodeTypeConfiguration[$propertyName];
         }
     }
     if ($nodeType->isAbstract()) {
         $metadata['abstract'] = true;
     }
     $this->types['typo3:' . $nodeTypeName] = (object) array('label' => $nodeType->getLabel() ?: $nodeTypeName, 'id' => 'typo3:' . $nodeTypeName, 'properties' => array(), 'specific_properties' => $nodeTypeProperties, 'subtypes' => array(), 'metadata' => (object) $metadata, 'supertypes' => $this->superTypeConfiguration['typo3:' . $nodeTypeName], 'url' => 'http://www.typo3.org/ns/2012/Flow/Packages/Neos/Content/', 'ancestors' => array(), 'comment' => '', 'comment_plain' => '');
 }
コード例 #4
0
 /**
  * @param NodeType $nodeType
  * @return array<NodeType>
  */
 protected function getAllImplementedNodeTypes(NodeType $nodeType)
 {
     $types = array($nodeType);
     foreach ($nodeType->getDeclaredSuperTypes() as $superType) {
         $types = array_merge($types, $this->getAllImplementedNodeTypes($superType));
     }
     return $types;
 }