Neos\ContentRepository\Domain\Service\NodeTypeManager::loadNodeType PHP Method

loadNodeType() protected method

Load one node type, if it is not loaded yet.
protected loadNodeType ( string $nodeTypeName, array &$completeNodeTypeConfiguration, array $fullNodeTypeConfigurationForType = null ) : NodeType
$nodeTypeName string
$completeNodeTypeConfiguration array the full node type configuration for all node types
$fullNodeTypeConfigurationForType array
return Neos\ContentRepository\Domain\Model\NodeType
    protected function loadNodeType($nodeTypeName, array &$completeNodeTypeConfiguration, array $fullNodeTypeConfigurationForType = null)
    {
        if (isset($this->cachedNodeTypes[$nodeTypeName])) {
            return $this->cachedNodeTypes[$nodeTypeName];
        }
        if (!isset($completeNodeTypeConfiguration[$nodeTypeName])) {
            throw new Exception('Node type "' . $nodeTypeName . '" does not exist', 1316451800);
        }
        $nodeTypeConfiguration = $completeNodeTypeConfiguration[$nodeTypeName];
        try {
            $superTypes = isset($nodeTypeConfiguration['superTypes']) ? $this->evaluateSuperTypesConfiguration($nodeTypeConfiguration['superTypes'], $completeNodeTypeConfiguration) : [];
        } catch (NodeConfigurationException $exception) {
            throw new NodeConfigurationException('Node type "' . $nodeTypeName . '" sets super type with a non-string key to NULL.', 1416578395);
        } catch (NodeTypeIsFinalException $exception) {
            throw new NodeTypeIsFinalException('Node type "' . $nodeTypeName . '" has a super type "' . $exception->getMessage() . '" which is final.', 1316452423);
        }
        // Remove unset properties
        $properties = [];
        if (isset($nodeTypeConfiguration['properties']) && is_array($nodeTypeConfiguration['properties'])) {
            $properties = $nodeTypeConfiguration['properties'];
        }
        $nodeTypeConfiguration['properties'] = array_filter($properties, function ($propertyConfiguration) {
            return $propertyConfiguration !== null;
        });
        if ($nodeTypeConfiguration['properties'] === []) {
            unset($nodeTypeConfiguration['properties']);
        }
        $nodeType = new NodeType($nodeTypeName, $superTypes, $nodeTypeConfiguration);
        $this->cachedNodeTypes[$nodeTypeName] = $nodeType;
        return $nodeType;
    }