定制 dersonsena/yii2-widget-inputsaddon 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dersonsena/yii2-widget-inputsaddon

Composer 安装命令:

composer require dersonsena/yii2-widget-inputsaddon

包简介

A Widget for Yii 2 with a simple way to group fields with bootstrap components

README 文档

README

A Widget for Yii 2 with a simple way to group fields with bootstrap components

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require dersonsena/yii2-widget-inputsaddon "dev-master"

or add

"dersonsena/yii2-widget-inputsaddon": "dev-master"

to the require section of your composer.json file.

Properties

This widget supports all the parameters similar to the \yii\widgets\InputWidget widget. The following additional properties are important for the plugin configuration:

side

string the side of the Group Addon. Possibles values:

  • AddonAbstract::RIGHT_SIDE (default value);
  • AddonAbstract::LEFT_SIDE.

size

string the size css class of the Group Addon. See more in: http://getbootstrap.com/components/#input-groups-sizing. Possibles values:

  • AddonAbstract::SIZE_DEFAULT (default value);
  • AddonAbstract::SIZE_LARGE;
  • AddonAbstract::SIZE_SMALL;

icon

string the icon css class or text of the Group Addon;

useIconText

boolean if true, the widget will render a text instead of a HTML icon

Usage Input Addon's

The implementations below can be done by widgets: AreaAddon, EmailAddon, MoneyAddon, PercentAddon and PhoneAddon:

// the widget usege WITH ActiveForm and model. Minimal configuration
echo $form->field($model, 'IMO_VAL_ARE')
    ->widget(EmailAddon::className());

// the widget usege WITHOUT ActiveForm or model
echo EmailAddon::widget([
    'name' => 'person_email',
    'value' => 'username@email.com.br'
]);

// the example for costumization
echo $form->field($model, 'email_field')
    ->widget(EmailAddon::className(), [
        'side' => EmailAddon::RIGHT_SIDE,
        'size' => EmailAddon::SIZE_LARGE,
        'icon' => 'fa fa-envelope' // default is: glyphicon glyphicon-envelope
        'forceEmailType' => true, // Force the input field to be email type. Available only for EmailAddon
        'options' => [
            'placeholder' => 'Type your email...'
        ]
    ])

// Text instead icon
echo $form->field($model, 'email_field')
    ->widget(EmailAddon::className(), [
        'icon' => '@'
        'useIconText' => true
    ])

Usage Buttons Addon

The bootstrap Button Addons. Please, for more details, see the http://getbootstrap.com/components/#input-groups-buttons.

echo $form->field($model, 'person_id')
    ->widget(ButtonsAddon::className(), [
        'buttons' => [
            Html::button("<i class='glyphicon glyphicon-search'></i>", ['class' => 'btn btn-primary']),
            Html::button("Add", ['class' => 'btn btn-default', 'onclick' => 'alert("Add")']),
            Html::button("Remove", ['class' => 'btn btn-danger'])
        ]
    ])

统计信息

  • 总下载量: 58
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固