locomotivemtl / charcoal-contrib-content-builder
内容构建器样式附件的实用工具,使用分组附件小部件。
0.3.1
2019-03-21 15:13 UTC
Requires
- php: >=5.6.0
- locomotivemtl/charcoal-attachment: ~0.10
- locomotivemtl/charcoal-cms: ~0.5
- locomotivemtl/charcoal-core: ~0.3
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^6.5
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-09-07 01:53:26 UTC
README
一个Charcoal服务提供内容构建器。
目录
安装
首选(也是唯一支持的)方法是使用Composer
$ composer require locomotivemtl/charcoal-contrib-content-builder
依赖
- Charcoal-core ~0.3
- Charcoal-cms ~0.5
- Charcoal-attachment ~0.9
必需
- PHP 5.6+:推荐使用PHP 7。
配置
在模型或TemplateableInterface的实例上使用ContentBuilderInterface。使用常规方法配置附件组。例如
{
"attachables": {
"exemple/attachments/object/text": {
"label": {
"en": "Text",
"fr": "Texte"
}
}
},
"groups": {
"content": [
"exemple/attachments/object/text"
]
},
"widgets": {
"content": {
"title": {
"en": "Content",
"fr": "Contenu"
},
"show_title": true,
"show_header": true,
"icon": "edit",
"template": "charcoal/admin/widget/form-group/attachment",
"group": "content",
"attachment_heading": "{{ ident }}",
"show_attachment_heading": false,
"show_attachment_preview": true,
"attachment_options": {
"show_preview": true,
"show_heading": false
},
"priority": 100,
"attachable_objects": "content"
}
}
}
使用
附加任何基于此结构模型的接口
{
"attachments": {
"widgets": {
"content": {
"type": "charcoal/admin/widget/form-group/attachment",
"preset": "content"
}
}
}
}
这将动态地将附件组添加到模型中。如果模型实现了TemplateableInterface,则可以提供接口给模板控制器。这将根据模板上下文动态地向模型添加附件组。这对于例如section对象非常有用,例如,允许根据模板轻松地使用不同的附件组。
开发
安装开发环境
$ composer install
运行脚本(phplint、phpcs和phpunit)
$ composer test
API 文档
- 自动生成的
phpDocumentorAPI 文档可在以下位置获得:
https://locomotivemtl.github.io/charcoal-contrib-content-builder/docs/master/ - 自动生成的
apigenAPI 文档可在以下位置获得:
https://codedoc.pub/locomotivemtl/charcoal-contrib-content-builder/master/
开发依赖
- [php-coveralls/php-coveralls][phpcov]
- [phpunit/phpunit][phpunit]
- [squizlabs/php_codesniffer][phpcs]
编码风格
charcoal-contrib-content-builder模块遵循Charcoal编码风格
- PSR-1
- PSR-2
- PSR-4,因此自动加载由Composer提供。
- phpDocumentor注释。
- phpcs.xml.dist和.editorconfig用于编码标准。
可以使用
composer phpcs执行编码风格验证/执行。还可以使用composer phpcbf提供自动修复器。
致谢
许可
Charcoal根据MIT许可证授权。有关详细信息,请参阅LICENSE。