PHP code example of flowpack / nodegenerator

1. Go to this page and download the library: Download flowpack/nodegenerator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flowpack / nodegenerator example snippets


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;
	}
}