2amigos/yii2-bootstrap-form-helpers-library

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

为Yii2提供的Bootstrap表单辅助小部件。

安装次数: 19,309

依赖关系: 0

建议者: 0

安全: 0

星标: 9

关注者: 22

分支: 3

语言:JavaScript

类型:yii2-extension

0.1.1 2014-05-08 09:38 UTC

This package is auto-updated.

Last update: 2023-08-16 03:06:45 UTC


README

Bootstrap表单辅助小部件库允许您使用Vincent Lamanna创建的惊人的jQuery插件集合,并帮助您构建更好看的表单。

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一:

php composer.phar require "2amigos/yii2-bootstrap-form-helpers-library" "*"

"2amigos/yii2-bootstrap-form-helpers-library" : "*"

将以下内容添加到您的应用程序的 composer.json 文件的要求部分。

使用方法

该库包含以下小部件

  • 颜色选择器
  • 国家选择器
  • 货币选择器
  • 日期选择器
  • 字体选择器
  • 字体大小选择器
  • Google字体选择器
  • 语言选择器
  • 数字输入
  • 电话输入
  • 选择器
  • 滑块
  • 州选择器
  • 时间选择器
  • 时区选择器

选择器(Select)是具有下拉列表的,在用法上几乎相同。以下示例展示了如何使用输入和下拉列表。我相信您会找到如何使用其他小部件的方法,直到我们为所有扩展编写了适当的文档网站。

// using Select Widget, the custom select HTML element of the library

dosamigos\formhelpers\Select::widget([
    'model' => $model,
    'attribute' => 'attributeName',
    'items' => [
        '1' => 'One option',
        '2' => 'Another option'
    ],
    // for all possible client options, please see
    // http://bootstrapformhelpers.com/select/#jquery-plugins
    'clientOptions' => [
        'filter' => 'true' // boolean must be as a string
    ]
]);

// using the NumberInput
dosamigos\formhelpers\NumberInput::widget([
    'model' => $model,
    'attribute' => 'updated_at',
    // not required if we use it with yii\bootstrap\ActiveForm
    'options' => ['class' => 'form-control'],
    // for all possible client options, please see
    // http://bootstrapformhelpers.com/number/#jquery-plugins
    'clientOptions' => [
        'min' => 20,
        'max' => 40
    ]
]);
// (remember that you can also use the following format)
use dosamigos\formhelpers\NumberInput;

$form->input($model, 'attribute')->widget(NumberInput::className(),['clientOptions' => ['min' => 20, 'max' => 40]]);

// using the DatePicker with a selected language
dosamigos\formhelpers\DatePicker::widget([
    'model' => $model,
    'attribute' => 'updated_at',
    'language' => 'es_ES',
    'clientOptions' => [
        'format' => 'm/d/y',
    ]
]);

// using the CurrencyPicker with flags
dosamigos\formhelpers\CurrencyPicker::widget([
    'model' => $model,
    'attribute' => 'updated_at',
    // important! if we don't use the custom select HTML we won't see the flags
    'selectBox' => true,
    'clientOptions' => [
        'flags' => 'true',
    ]
])

更多信息

有关不同插件的多个选项的更多信息,请访问其网站

2amigOS!

网络开发从未如此有趣! www.2amigos.us