定制 flowpack/nodegenerator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flowpack/nodegenerator

Composer 安装命令:

composer require flowpack/nodegenerator

包简介

Random nodes generator for Neos CMS

README 文档

README

Configuration of the Node generator classes

In your Settings.yaml you can register a node generator class. Each node type used in your setup, must have an attached generator class.

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'

Minimal Generator Class

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.

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

Configuration of presets

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.

The Extension is shipped with some examples of presets, a basic preset looks like:

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

Run your preset

./flow generator:nodes --site-node blog --preset small-blog

Configure the root node

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:

flow generator:nodes --site-node homepage --preset small-blog --path blog

统计信息

  • 总下载量: 2.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固