2017 © Pedro Peláez
 

yii2-extension yii2-dynamicvalue

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

image

kirillantv/yii2-dynamicvalue

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

  • Wednesday, September 6, 2017
  • by kirillantv
  • Repository
  • 0 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 20 % Grown

The README.md

yii2-dynamicvalue

1. Download

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

composer require kirillantv/yii2-dynamicvalue

or you can add following require to composer.json:, (*2)

...
"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:, (*3)

<?= 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:, (*4)

data is model with your data. It would be nice if it will be active record model., (*5)

column is property of your model or column of DB., (*6)

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

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:, (*8)

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

label is a text output., (*9)

link is optional parameter. If you will set it, widget will render a hypertext link., (*10)

encode - boolean property. If you want to encode label you have to set it true. By default label is not encoded., (*11)

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

optionsis array the tag options in terms of name-value pairs., (*13)

**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. **, (*14)

The Versions

06/09 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Kirill Antonov

yii2 generator html widget value render kirillantv dynamicvalue

06/09 2017

v1.0.1

1.0.1.0

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

  Sources   Download

MIT

The Requires

 

by Kirill Antonov

yii2 generator html widget value render kirillantv dynamicvalue

06/09 2017

v1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

 

by Kirill Antonov

yii2 generator html widget value render kirillantv dynamicvalue