Neos\Neos\Domain\Service\DefaultPrototypeGenerator::generate PHP Method

generate() public method

A node will be rendered by Neos.Neos:Content by default with a template in resource://PACKAGE_KEY/Private/Templates/NodeTypes/NAME.html and forwards all public node properties to the template TypoScript object.
public generate ( NodeType $nodeType ) : string
$nodeType Neos\ContentRepository\Domain\Model\NodeType
return string
    public function generate(NodeType $nodeType)
    {
        if (strpos($nodeType->getName(), ':') === false) {
            return '';
        }
        $output = 'prototype(' . $nodeType->getName() . ') < prototype(' . $this->basePrototypeName . ') {' . chr(10);
        list($packageKey, $relativeName) = explode(':', $nodeType->getName(), 2);
        $templatePath = 'resource://' . $packageKey . '/Private/Templates/NodeTypes/' . $relativeName . '.html';
        $output .= "\t" . 'templatePath = \'' . $templatePath . '\'' . chr(10);
        foreach ($nodeType->getProperties() as $propertyName => $propertyConfiguration) {
            if (isset($propertyName[0]) && $propertyName[0] !== '_') {
                $output .= "\t" . $propertyName . ' = ${q(node).property("' . $propertyName . '")}' . chr(10);
                if (isset($propertyConfiguration['type']) && isset($propertyConfiguration['ui']['inlineEditable']) && $propertyConfiguration['type'] === 'string' && $propertyConfiguration['ui']['inlineEditable'] === true) {
                    $output .= "\t" . $propertyName . '[email protected] = Neos.Neos:ConvertUris' . chr(10);
                }
            }
        }
        $output .= '}' . chr(10);
        return $output;
    }
DefaultPrototypeGenerator