leoruhland/cakephp-fieldtypes
Composer 安装命令:
composer require leoruhland/cakephp-fieldtypes
包简介
FieldTypes plugin for CakePHP. CakeAdmin compatible.
README 文档
README
Note: This is a non-stable plugin for CakePHP 3.x at this time. It is currently under development and should be considered experimental.
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require leoruhland/cakephp-fieldtypes
Now load the plugin with the command:
bin/cake plugin load -r -b FieldTypes
Usage
You can use the FieldTypes extending core FormHelper with BootstrapUI.Form
then setting the widgets you want to use.
$this->loadHelper('Form', [ 'className' => 'BootstrapUI.Form', 'widgets' => [ //Date 'flatpickr' => ['FieldTypes\View\Widget\FlatpickrWidget', '_view'], 'bootstrap-datepicker' => ['FieldTypes\View\Widget\BootstrapDatepickerWidget', '_view'], 'bootstrap-datetimepicker' => ['FieldTypes\View\Widget\BootstrapDatetimepickerWidget', '_view'], //Color 'bootstrap-colorpicker' => ['FieldTypes\View\Widget\BootstrapColorpickerWidget', '_view'], //Number 'bootstrap-touchspin' => ['FieldTypes\View\Widget\BootstrapTouchspinWidget', '_view'], //Boolean 'bootstrap-switch' => ['FieldTypes\View\Widget\BootstrapSwitchWidget', '_view'], //Content 'summernote' => ['FieldTypes\View\Widget\SummernoteWidget', '_view'], 'wysiwygjs' => ['FieldTypes\View\Widget\WysiwygjsWidget', '_view'], //Select 'bootstrap-select' => ['FieldTypes\View\Widget\BootstrapSelectWidget', '_view'], 'select2' => ['FieldTypes\View\Widget\Select2Widget', '_view'], //Other 'stringtoslug' => ['FieldTypes\View\Widget\StringToSlugWidget', '_view'], 'textcount' => ['FieldTypes\View\Widget\TextCounterWidget', '_view'], ] ]);
You can override default widgets too.
$this->loadHelper('Form', [ 'className' => 'BootstrapUI.Form', 'widgets' => [ 'date' => ['FieldTypes\View\Widget\FlatpickrWidget', '_view'], 'select' => ['FieldTypes\View\Widget\Select2Widget', '_view'] ] ]);
And then, using it:
$this->Form->input('some_field', ['type' => 'summernote']);
It also works nice with CakeAdmin formFields.
public function postType() { return [ 'formFields' => [ 'some_field' => [ 'type' => 'summernote', ], ] ]; };
Types
Select2 - GitHub
'type' => 'select2'
'type' => 'select2', 'multiple' => true
Summernote - GitHub
'type' => 'summernote'
Bootstrap Datepicker - GitHub
'type' => 'datepicker'
Bootstrap Colorpicker - GitHub
'type' => 'colorpicker'
Bootstrap TouchSpin - GitHub
'type' => 'touchspin'
Bootstrap Toggle - GitHub
'type' => 'toggle'
CakeAdmin
The plugin is CakeAdmin compatible!
统计信息
- 总下载量: 490
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-26