public function validateByOnlyOne($nodeType, TreeInterface $tree)
    {
        if (!$nodeType) {
            return true;
        }

        $config = $this->getNodeTypeConfig($nodeType);
        if (null === $config) {
            return false;
        }

        if ($config->isOnlyOne()) {
            return !in_array($nodeType, $this->nodeManager->findExistingNodeTypes($tree));
        }

        return true;
    }
public function validateByOnlyOne($nodeType, TreeInterface $tree)
    {
        if (!$nodeType) {
            return true;
        }

        $config = $this->getNodeTypeConfig($nodeType);
        if (null === $config) {
            return false;
        }

        if ($config->isOnlyOne()) {
            return !in_array($nodeType, $this->nodeManager->findExistingNodeTypes($tree));
        }

        return true;
    }
public function validateByOnlyOne ( $ nodeType , TreeInterface $ tree ) { if ( ! $ nodeType ) { return true ; } $ config = $ this -> getNodeTypeConfig ( $ nodeType ) ; if ( null === $ config ) { return false ; } if ( $ config -> isOnlyOne ( ) ) { return ! in_array ( $ nodeType , $ this -> nodeManager -> findExistingNodeTypes ( $ tree ) ) ; } return true ; }
Validate by only one.

@param string $nodeType
@param TreeInterface $tree

@return bool
Validate by only one .