定制 punktde/archivist 二次开发

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

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

punktde/archivist

最新稳定版本:2.8.3

Composer 安装命令:

composer require punktde/archivist

包简介

A Neos CMS package that automatically sorts nodes into a predefined structure which is created on the fly.

README 文档

README

Travis Build Status Latest Stable Version Total Downloads

Purpose of this package: Automatically sorts nodes into a predefined structure which is created on the fly.

Neos has some drawbacks, if you store lots of Node - like news for example - on the same hierarchical level. Especially the backend trees are getting slow and confusing. This package automatically sorts this nodes in a configured and automatically created hierarchy.

Configuration

You can configure the behavior differently for every triggering node type. The configuration options are best explained by example. These examples are taken from Configuration/Testing/Settings.yaml and are thus automatically tested.

Simple Example

Configuration for the nodeType 'PunktDe.Archivist.TriggerNode'. The sorting is triggered if a node of this type is created or if a property on this node is changed. This node is then available as 'node' in the other parts of the configuration

PunktDe:
  Archivist:
    sortingInstructions:

      'PunktDe.Archivist.TriggerNode':

        # The query selecting the root node of the automatically created hierarchy
        hierarchyRoot: "${q(site).find('[instanceof Neos.ContentRepository.Testing:Page]').get(0)}"

        # Optional: The sorting of the nodes inside the target hierarchy. Can be the name of a property
        # or an eel expression like seen below
        sorting: title

        # Optional: Trigger sorting only, when condition is met. Can be used to make sure that required properties are set as expected.
        condition: "${node.properties.date != null}"

        # In the context is evaluated first. You can define variables here which you can use in
        # the remaining configuration
        context:
          publishDate: "${node.properties.date}"

        # Automatically publish the created document hierarchy
        publishHierarchy: true

        # Definition of the auto-generated hierarchy
        hierarchy:
          -
            # The type of the hierarchy-node
            type: 'PunktDe.Archivist.HierarchyNode'

            # Properties of the new created node.
            properties:
              name: "${Date.year(publishDate)}"
              title: "${Date.year(publishDate)}"
              hiddenInIndex: "${true}"

            # The property which is identical throughout all nodes of this level
            identity: title

            # An eel query that describes the sorting condition
            sorting: "${q(a).property('title') < q(b).property('title')}"
          -
            type: 'PunktDe.Archivist.HierarchyNode'
            properties:
              name: "${Date.month(publishDate)}"
              title: "${Date.month(publishDate)}"
            identity: title

            # Simple sorting on a property
            sorting: title

Example with a triggering content node

A content node triggers the move of its parent document node. For example, if you have a title node which should be considered to move the page.

PunktDe:
  Archivist:
    sortingInstructions:
      'PunktDe.Archivist.TriggerContentNode':

        # The query selecting the root node of the automatically created hierarchy
        hierarchyRoot: "${q(site).find('[instanceof Neos.ContentRepository.Testing:Page]').get(0)}"

        # Optional: The node to be moved, described by an Eel query.
        # This defaults to the triggering node if not set. The triggering node is available as "node".
        # If the affected node is not found by the operation is skipped.
        # This can for example be used if a change in a content node should move its parent document node
        #
        affectedNode: "${q(node).parent('[instanceof Neos.ContentRepository.Testing:Document]').get(0)}"

        # Definition of the auto-generated hierarchy
        hierarchy:
          -
            # The type of the hierarchy-node
            type: 'PunktDe.Archivist.HierarchyNode'

            # Properties of the new created node.
            properties:
              name: "${Archivist.buildSortingCharacter(title)}"
              title: "${Archivist.buildSortingCharacter(title)}"

Define multiple configurations for the same NodeType

In addition to

PunktDe:
  Archivist:
    sortingInstructions:
      MyNode.Type:
        hierarchyRoot: # ...

you can now do this:

PunktDe:
  Archivist:
    sortingInstructions:
      MyNode.Type:
        foo1:
          hierarchyRoot:  # ...
        foo2:
          hierarchyRoot:  # ...

Make sure, to define a conditon to not run several configurations on the same Node action.

Archivist Eel Helper

Archivist.buildSortingCharacter(string, position = 0, length = 1) Generates upper case sorting characters from the given string. Starting position and length can be defined.

统计信息

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

GitHub 信息

  • Stars: 18
  • Watchers: 7
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-23