此包已被放弃,不再维护。未建议替代包。
Silverstripe 管理字段,让您提供更多描述内容
0.1.0
2020-07-03 01:52 UTC
Requires
This package is auto-updated.
Last update: 2024-03-07 11:11:49 UTC
README
这是一个 Silverstripe CMS 的插件,它提供了一些自定义字段类型,可以提供更多描述选项的空间。它仅设计用于与 admin UI 一起使用。
目前,只实现了 VerboseOptionsetField,但我欢迎贡献 VerboseCheckboxSetField。
状态
实验性。 此模块刚刚从一个项目代码中推出,尚未完成第二次实现。如果您成功在一个项目中使用此模块,请告诉我!
用法
首先,安装模块。
> composer require sminnee/silverstripe-verbosefields
该字段的使用方式类似于 OptionsetField。使用 setSourceDescriptions()
可以为您指定每个项的 HTML 描述的映射。
use Sminnee\VerboseFields\VerboseOptionsetField; // ... function getCMSFields() { $fields = parent::getCMSFields(); $descriptions = [ 'Apple' => '<b>Apple</b><p>A delicious fruit and also a hardware manufacturerer.<p><p><img src="..."></p>', 'Orange' => '<b>Orange</b><p>A fruit that is usually turned into juice, rendering something somewhat healthy into a healthy-seeming confection.</p>', 'Pear' => '<b>Pear</b><p>A ripe pear is an excellent choice for when your hands are too clean and need to be stickier.</p>', ]; $source = [ 'Apple' => 'Apple', 'Orange' => 'Orange', 'Pear' => 'Pear', ]; $fields->addFieldToTab( 'Root.Tab', (new VerboseOptionsetField('Fruit', 'Fruit')) ->setSource($source) ->setSourceDescriptions($descriptions); }
贡献
欢迎拉取请求!问题可以被容忍。