kunicmarko/color-picker-bundle

该包已被废弃,不再维护。未建议替代包。

这是一个添加颜色选择器表单类型的Symfony Bundle。

1.1.0 2017-12-09 23:21 UTC

This package is auto-updated.

Last update: 2020-11-16 04:33:25 UTC


README

Build Status SensioLabsInsight StyleCI Coverage Status

为Symfony添加颜色选择器表单类型。

基于tinyColorPicker构建。

文档

安装

1. 将以下内容添加到composer.json文件中的require

composer require kunicmarko/color-picker-bundle

2.app/AppKernel.php中注册该bundle

$bundles = array(
    // ...
    new KunicMarko\ColorPickerBundle\ColorPickerBundle(),
);

3. 安装资源

app/console assets:install

如何使用

在表单中,您可以添加如下内容

// Symfony 2.8 and newer versions
use KunicMarko\ColorPickerBundle\Form\Type\ColorPickerType;

$builder->add('field', ColorPickerType::class);

在body/layout的末尾添加以下内容

<script type="text/javascript" src="{{ asset('bundles/colorpicker/js/jqColorPicker.min.js') }}"></script>
<script type="text/javascript">
    $('.colorpicker').colorPicker();
</script>