dev-master
9999999-devRandom nodes generator for TYPO3 Neos
MIT
The Requires
Random nodes generator for TYPO3 Neos
In your Settings.yaml you can register a node generator class. Each node type used in your setup, must have an attached generator class., (*1)
Flowpack: NodeGenerator: generator: 'Neos.NodeTypes:Page': class: 'Flowpack\NodeGenerator\Generator\Document\PageGeneratorImplementation' 'Neos.NodeTypes:Text': class: 'Flowpack\NodeGenerator\Generator\Content\TextGeneratorImplementation' 'Neos.NodeTypes:Image': class: 'Flowpack\NodeGenerator\Generator\Content\ImageGeneratorImplementation' 'Neos.NodeTypes:TextWithImage': class: 'Flowpack\NodeGenerator\Generator\Content\TextWithImageGeneratorImplementation'
The NodesGenerators who call your node generator class, will catch NodeExistsException so you don't need to take care about that. The generator will skip silently nodes that currently exist in the content repository., (*2)
class PageGeneratorImplementation extends AbstractNodeGeneratorImplementation { /** * @param NodeInterface $parentNode * @param NodeType $nodeType * @return NodeInterface */ public function create(NodeInterface $parentNode, NodeType $nodeType) { $title = Company::name(); $name = Utility::renderValidNodeName($title); $childrenNode = $parentNode->createNode($name, $nodeType); $childrenNode->setProperty('title', $title); return $childrenNode; } }
If multiple Content and Document node types are configured, the generator will select a random node type for each new node. Take care to declare a generator class for each node type., (*3)
The Extension is shipped with some examples of presets, a basic preset looks like:, (*4)
Flowpack: NodeGenerator: preset: # Basic website, with a multiple level page tree small-website: depth: 3 nodeByLevel: 10 contentNodeByDocument: 5 documentNodeType: [ 'Neos.NodeTypes:Page' ] contentNodeType: [ 'Neos.NodeTypes:Text', 'Neos.NodeTypes:Images' ] # Randomness of the number of nodes generated from 0 to 100 randomness: 25
./flow generator:nodes --site-node blog --preset small-blog
By default all the generated pages will be created on the root-level of the site. This behavior can be changed by providing a specific path to an existing node:, (*5)
flow generator:nodes --site-node homepage --preset small-blog --path blog
Random nodes generator for TYPO3 Neos
MIT