Jackalope\NodeType\NodeTypeManager::getSubtypes PHP Method

getSubtypes() public method

Helper method for NodeType: Returns all sub types of a node and their sub types.
See also: NodeType::getSubtypes
public getSubtypes ( string $nodeTypeName ) : array
$nodeTypeName string
return array with the names of the subnode types pointing to the node type instances
    public function getSubtypes($nodeTypeName)
    {
        // OPTIMIZE: any way to avoid loading all nodes at this point?
        $this->fetchNodeTypes();
        $ret = array();
        if (isset($this->nodeTree[$nodeTypeName])) {
            foreach ($this->nodeTree[$nodeTypeName] as $name => $subnode) {
                $ret = array_merge($ret, array($name => $subnode), $this->getSubtypes($name));
            }
        }
        return $ret;
    }