/** * @param NodeInterface $parentNode * @param NodeType $nodeType * @return NodeInterface|void */ public function create(NodeInterface $parentNode, NodeType $nodeType) { $node = parent::create($parentNode, $nodeType); $node->setProperty('image', $this->getRandommImageVariant()); if (rand(0, 10) === 0) { $node->setProperty('hasCaption', true); $node->setProperty('caption', Lorem::sentence(rand(5, 12))); $node->setProperty('title', Lorem::sentence(rand(5, 12))); $node->setProperty('alternativeText', Lorem::sentence(rand(5, 12))); } return $node; }
/** * @param NodeInterface $parentNode * @param NodeType $nodeType * @return NodeInterface */ public function create(NodeInterface $parentNode, NodeType $nodeType) { $contentNode = $parentNode->createNode(uniqid('node'), $nodeType); $contentNode->setProperty('text', sprintf('<p>%s</p>', Lorem::paragraph(rand(1, 10)))); return $contentNode; }