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

allowsGrandchildNodeType() public method

Only allowed to be called if $childNodeName is auto-created.
public allowsGrandchildNodeType ( string $childNodeName, NodeType $nodeType ) : boolean
$childNodeName string The name of a configured childNode of this NodeType
$nodeType NodeType The NodeType to check constraints for.
return boolean TRUE if the $nodeType is allowed as grandchild node, FALSE otherwise.
    public function allowsGrandchildNodeType($childNodeName, NodeType $nodeType)
    {
        $autoCreatedChildNodes = $this->getAutoCreatedChildNodes();
        if (!isset($autoCreatedChildNodes[$childNodeName])) {
            throw new \InvalidArgumentException('The method "allowsGrandchildNodeType" can only be used on auto-created childNodes, given $childNodeName "' . $childNodeName . '" is not auto-created.', 1403858395);
        }
        $constraints = $autoCreatedChildNodes[$childNodeName]->getConfiguration('constraints.nodeTypes') ?: array();
        $childNodeConfiguration = [];
        foreach ($this->getConfiguration('childNodes') as $name => $configuration) {
            $childNodeConfiguration[Utility::renderValidNodeName($name)] = $configuration;
        }
        $childNodeConstraintConfiguration = ObjectAccess::getPropertyPath($childNodeConfiguration, $childNodeName . '.constraints.nodeTypes') ?: array();
        $constraints = Arrays::arrayMergeRecursiveOverrule($constraints, $childNodeConstraintConfiguration);
        return $this->isNodeTypeAllowedByConstraints($nodeType, $constraints);
    }