Neos\ContentRepository\Domain\Model\NodeType::isOfType PHP Method

isOfType() public method

If this node type or any of the direct or indirect super types has the given name.
public isOfType ( string $nodeType ) : boolean
$nodeType string
return boolean TRUE if this node type is of the given kind, otherwise FALSE
    public function isOfType($nodeType)
    {
        if ($nodeType === $this->name) {
            return true;
        }
        foreach ($this->declaredSuperTypes as $superType) {
            if ($superType !== null && $superType->isOfType($nodeType) === true) {
                return true;
            }
        }
        return false;
    }

Usage Example

 /**
  * @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'));
 }
All Usage Examples Of Neos\ContentRepository\Domain\Model\NodeType::isOfType