chrometoaster/silverstripe-advanced-taxonomies
Composer 安装命令:
composer require chrometoaster/silverstripe-advanced-taxonomies
包简介
Advanced taxonomies
README 文档
README
Overview
Inspired by the Silverstripe's Taxonomy module, Chrometoaster's Advanced taxonomies module also adds the capability to manage hierarchical taxonomies within Silverstripe.
It also provides generic CMS interfaces to assign taxonomy terms (tag) to pages and files, and provides means how to extend this functionality to any other data objects, such as e.g. Elemental blocks.
Beyond basic terms tagging, the module aims to help professional information architects and content designers who wish to use taxonomies to classify most - if not all - of the content across a site, using a suite of interrelated hierarchical taxonomies. Advanced logic makes the use of taxonomies a more robust option for content-wide relationships, especially where multiple taxonomies must be used in conjunction.
Please note that this module is intended to replace Silverstripe's taxonomy module, it's not an extension to it. This module discards taxonomy type as a standalone model, accommodating the type atrributes via top-level taxonomy terms, sometimes referenced as types throughout the code base for legibility and context.
Main features
Main features of the taxonomy term model and associated extensions, helpers, validators etc.
Singular and Plural display names
- Extra names to be used in different situations, both on front-end and in the back-end
Description
- A term description used throughout the CMS (e.g. within grid fields) to aid editors while tagging (useful when there are similar terms under different taxonomies).
Definition fields
- Author facing definition to be used within the CMS
- End-users facing definition, e.g. used in glossaries
Single-select option
- A taxonomy can be defined as 'single-select' or 'multi-select', depending on the nature of the terms/concepts — being synergistic or mutually exclusive.
- Validation rules apply when authors tag data objects with a single-select taxonomy term (i.e. only one term can be tagged at a time).
Internal only option
- A taxonomy can be dedicated as internal only, i.e. it won't be visible to end-users, marking the taxonomy to be used for 'administrative purposes' only — creating lists of items in the CMS, filtering etc.
Required taxonomies
- Any term can be configured with one or more Required taxonomies.
- Required taxonomies will prompt authors to select a term from other taxonomies, too, when the current term is assigned to a data object.
- If required taxonomies are set on the root term, then all descendant terms will inherit the requirements. Inheritance can be manually overridden, and further requirements configured, on individual terms.
URLSegment
- A globally unique slug, currently globally unique (this constrain may be relaxed going forward to allow the same segments under different parents).
Usage
Requirements
- SilverStripe 4.x
- PHP ^7.3 (PHP8 not tested)
Installation
composer require chrometoaster/silverstripe-advanced-taxonomies
Configuration
By default, the module applies the DataObjectTaxonomiesDataExtension extension to SiteTree and File classes
in the config.yml.
To add the extension to your project-specific data models, create a yaml config file similar to the example below:
App\Models\YourDataModel: extensions: - Chrometoaster\AdvancedTaxonomies\Extensions\DataObjectTaxonomiesDataExtension App\Models\YourOtherCustomDataModel: extensions: - Chrometoaster\AdvancedTaxonomies\Extensions\DataObjectTaxonomiesDataExtension
There are some settings that can be modified in this module, depending on requirements. These are listed below.
Developer's notes
HTML in validation messages
The Chrometoaster\AdvancedTaxonomies\Validators\TaxonomyRulesValidator produces error messages in a HTML format.
This behaviour can be sometimes problematic, especially in a React-like parts of the CMS, e.g. the assets admin.
For this purpose the validator offers a method to disable the HTML output, effectively applying plaintext term
decorators instead of richtext ones.
If you need to use the same behaviour, i.e. output just a plaintext error messages, set the attribute after getting an instance of the validator e.g. in a data extension like:
use Chrometoaster\AdvancedTaxonomies\Validators\TaxonomyRulesValidator; $validator = TaxonomyRulesValidator::create(); $validator->setHTMLOutput(false); // get the validation error or empty string $requiredTypesValidationError = $validator->validateRequiredTypes($this->getOwner()->Tags()); // use the validation message further // ...
Validation in the CMS and the assets-admin section
In the 'asset-admin' interface, when tags are assigned to a file, the message only appears after saving the file, whereas within the pages section (any non-react context), the validation is performed on the fly when adding the terms through the 'Add tag' gridfield interface.
Contributing
Code guidelines
This project follows the standards defined in:
If you are helping out, please also follow the standards above.
Translations
We would like to support multiple languages in the long term, however only some aspects of the codebase are translated at the moment.
Please refer to the "i18n" topic on docs.silverstripe.org for more details if you wish to contribute in this are of development.
chrometoaster/silverstripe-advanced-taxonomies 适用场景与选型建议
chrometoaster/silverstripe-advanced-taxonomies 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.92k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 09 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「taxonomy」 「silverstripe」 「advanced taxonomies」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chrometoaster/silverstripe-advanced-taxonomies 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chrometoaster/silverstripe-advanced-taxonomies 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chrometoaster/silverstripe-advanced-taxonomies 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Icon support for Silverstripe taxonomy terms
Elemental Taxonomy module, provides a list of taxonomy terms under a selected type
WordPress plugin to automatically toggle the parent term when a sub term is selected.
Feehi CMS Project Template
Analytics chooser extensions for site settings.
统计信息
- 总下载量: 1.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-09-20