dnadesign / silverstripe-tagurit
一个替代的分类模块,提供受保护类型,并反转标签/类型关系到类型/标签
dev-master
2023-11-21 03:11 UTC
Requires
- silverstripe/framework: ^4.0 || ^5.0
- silverstripe/vendor-plugin: ^1.0 || ^2.0
- symbiote/silverstripe-gridfieldextensions: ^3.2 || ^4.0
This package is auto-updated.
Last update: 2024-09-21 04:48:20 UTC
README
为 SilverStripe 提供一个替代的分类模块
简介
此模块反转术语/类型关系为类型/术语,并允许设置默认/受保护的类型/术语
要求
- SilverStripe 4.4
- GridFieldExtensions 3.2
安装
在您的 composer.json 中包含以下内容,并运行 composer update
"require": {
dnadesign/silverstripe-tagurit
}
"repositories": [ { "type": "git", "url": "https://github.com/dnadesign/silverstripe-tagurit.git" } ],
配置 yml 文件
tagurit_protected_taxonomy: Type one: - Term - Second Term Second type: - Another Term
在您的页面上使用该特质
use TaxonomyTrait; private static $many_many = [ 'CustomTerms' => TaxonomyTerm::class ]; public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab( 'Root.Terms', [ ListboxField::create( 'CustomTerms', 'Custom Terms', $this->getTermsForType('Second type') ), ] ); return $fields; }
运行构建任务
vendor/silverstripe/framework/sake dev/build flush=1