kirillantv/yii2-dynamicvalue 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kirillantv/yii2-dynamicvalue

Composer 安装命令:

composer require kirillantv/yii2-dynamicvalue

包简介

DynamicValue widget allows you to generate HTML content dynamicly depending on your data value

README 文档

README

1. Download

Yii2-DynamicValue extension can be installed using composer. Run the command bellow in console to download and install Yii2-swap:

composer require kirillantv/yii2-dynamicvalue

or you can add following require to composer.json:

...
"require": {
  ...
  "kirillantv/yii2-dynamicvalue": "*"
  ...
}

2. Usage

The DynamicValue widgets is used to display dynamic content depending on value of input data. You can use this widget adding following code to your view file and config items:

<?= DynamicValue::widget([
  'data' => $model,
  'column' => 'status',
  'items' => [
      [
          'value' => 1,
          'label' => 'Disable order',
          'link' => ['order/disable', 'id' => $model->id],
          'options' => ['class' => 'btn btn-danger btn-block']
  ],
      [
          'value' => 0,
          'tag' => 'span',
          'label' => 'Is done',
          'options' => ['class' => 'btn btn-success btn-block']
  ]]
  ]);

Widget has following parametres:

data is model with your data. It would be nice if it will be active record model.

column is property of your model or column of DB.

items is array of configuration arrays depending on values of the column. You can configure it by the next way:

value is value of column according to the current configuration. If you don't specify it, widget will take array indexes as value. Therefore you can set items array without value as follow:

'items' => [
    1 => [
        ...
    ],
    3 => [
        ...
    ],
    'textValue' => [
        ...
    ]
]

label is a text output.

link is optional parameter. If you will set it, widget will render a hypertext link.

encode - boolean property. If you want to encode label you have to set it true. By default label is not encoded.

tag is HTML tag wrapping your label. Ignored if you set link. By the default, it renders <div>

optionsis array the tag options in terms of name-value pairs.

**Note! By default, widget provides content for 'status' column, such as, active = 1, archive = 0 and error = -1 status. So if any of these values is not specified in config array the default content will be render. **

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固