定制 sitegeist/taxonomy 二次开发

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

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

sitegeist/taxonomy

Composer 安装命令:

composer require sitegeist/taxonomy

包简介

Manage vocabularies and taxonomies as separate node-hierarchy.

README 文档

README

Manage vocabularies and taxonomies in Neos as node in a separate subtree /taxonomies distinct from /sites

Authors & Sponsors

The development and the public releases of this package is generously sponsored by our employer http://www.sitegeist.de.

About

If taxonomies are defined as documents in the /sites subtree of the Neos ContentRepository, things tend to get complicated:

  • If the meaning of an item is determined by its position in a hierarchy, it is complicated to add more than one relation or relations for different contexts.
  • Mixing Taxonomies (meaning) with content (presentation) leads to a complicated structure that often is hard to comprehend for editors.
  • It is hard to share taxonomies across multiple sites.
  • It is hard to ensure taxonomies exist in all needed dimensions since this also affects the site structure.
  • Limiting read and write access to taxonomies inside sites is possible but not trivial.

Sitegeist.Taxonomies store vocabularies and taxonomies as nodes outside of the /sites hierarchy in the content repository. This way, the meaning of the taxonomy relations can be expressed better, taxonomies can be used across multiple sites and the taxonomy documents can be defined without interfering with the taxonomy meaning.

It also provides a separate backend module for managing vocabularies and taxonomies.

Installation

Sitegeist.Taxonomy is available via packagist composer require sitegeist/taxonomy. We use semantic-versioning, so every breaking change will increase the major version number.

Storing vocabularies and taxonomies in the ContentRepository

Sitegeist.Taxonomy defines three basic node types:

  • Sitegeist.Taxonomy:Root - The root node at the path /<Sitegeist.Taxonomy:Root>, allows only vocabulary nodes as children
  • Sitegeist.Taxonomy:Vocabulary - The root of a hierarchy of meaning, allows only taxonomies nodes as children
  • Sitegeist.Taxonomy:Taxonomy - An item in the hierarchy that represents a specific meaning allows only taxonomy nodes as children
    Sitegeist.Taxonomy:Root:
      childNodes:
        animals:
          type: 'Sitegeist.Taxonomy:Vocabulary'

Referencing taxonomies

Since taxonomies are nodes, they are simply referenced via reference or references properties:

    taxonomyReferences:
      type: references
      ui:
        label: 'Taxonomy References'
        inspector:
          group: taxonomy
          editorOptions:
            nodeTypes: ['Sitegeist.Taxonomy:Taxonomy']
            startingPoint: '/<Sitegeist.Taxonomy:Root>'
            placeholder: 'assign Taxonomies'

If you want to limit the selectable taxons to a vocabulary or even a taxonomy, then you can configure a more specific startingPoint:

    taxonomyReferences:
      ui:
        inspector:
          editorOptions:
            startingPoint: '/<Sitegeist.Taxonomy:Root>/animals/mammals'

Content-Dimensions

Vocabularies and Taxonomies will always be created in all base dimensions. This way, it is ensured that they can always be referenced. The title and description of a taxons and vocabularies can be translated as is required for the project.

Querying Taxonomies

The flow Query operations referenceNodes() and backReferenceNodes in combination to search for documents that have similar taxons assigned.

similarDocuments = ${
    q(documentNode)
        .referenceNodes('taxonomyReferences')                  // the taxons the current document references
        .backReferenceNodes('taxonomyReferences')              // all nodes that reference one of the same taxons
        .filter('[instanceof Neos.Neos:Document]')             // only documents
        .remove(documentNode)                                  // but nut the current one
        .get()
    }   

The package includes the following flowQuery operations:

  • referencedTaxonomies(): the taxons referenced by the documents in flowQuery context
  • referencingTaxonomies(): the documents referencing by the taxons in flowQuery context
  • subTaxonomies() : sub-taxons of taxons in the context
  • withSubTaxonomies(): current taxons in the context plus sub-taxons
similarDocuments = ${
  q(documentNode)
    .referencedTaxonomies()                                // the taxons the current document references
    .withSubTaxonomies()                                   // including all sub taxons
    .referencingTaxonomies()                               // the documents that reference the same taxons
    .remove(documentNode)                                  // but nut the current one
    .get()
  }   

CLI Commands

The taxonomy package includes some CLI commands for managing the taxonomies.

  • taxonomy:vocabularies List all vocabularies
  • taxonomy:taxonomies List taxonomies inside a vocabulary

Privileges

Sitegeist.Taxonomy brings the following privilege targets to allow you to restrict read access, management and editing of taxonomies:

  • Sitegeist.Taxonomy:Module.Show Show the backend Module and explore the existing taxonomies by default granted to Editors.
  • Sitegeist.Taxonomy:Module.ManageVocabularyActions Add, edit and delete vocabularies. By default granted to Administrators.
  • Sitegeist.Taxonomy:Module.ManageTaxonomyActions Add, edit and delete taxons. By default granted to Administrators.

Reading and referencing taxonomies from other nodes is currently not limited.

Extensibility

Packages can add additional fields to the forms of taxonomies and vocabularies. To do this the following steps are required.

  1. Extend the NodeTypes Sitegeist.Taxonomy:Taxonomy or Sitegeist.Taxonomy:Vocabulary in your package.
  2. Add tha path to your additional Root.fusion to the Setting in path Sitegeist.Taxonomy.backendModule.additionalFusionIncludePathes.
  3. In the fusion code define each field as prototype that accepts the props name plus taxon & defaultTaxon resp. vocabulary & defaultVocabulary.
  4. Register addtional prototypesNames by adding them to the Settings Sitegeist.Taxonomy.backendModule.additionalVocabularyFieldPrototypes or Sitegeist.Taxonomy.backendModule.additionalTaxonomyFieldPrototypes

Contribution

We will gladly accept contributions. Please send us pull requests.

License

See LICENSE

sitegeist/taxonomy 适用场景与选型建议

sitegeist/taxonomy 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 94.97k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2018 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 sitegeist/taxonomy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sitegeist/taxonomy 我们能提供哪些服务?
定制开发 / 二次开发

基于 sitegeist/taxonomy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 94.97k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 19
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 5
  • Forks: 16
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2018-05-30