A
A
Alexey2014-07-08 23:05:17
Yii
Alexey, 2014-07-08 23:05:17

\yii\bootstrap\Button::widget and how to send value?

Such a situation has arisen.
There is a button:

<?=\yii\bootstrap\Button::widget([
    'label' => Yii::t('app', 'Add to list'),
    'options' => ['class' => 'btn btn_small btn_green'],
]);?>

It is in the view (list.php) file that is generated by the ListController/actionList controller.
The task is as follows, you need to send the $data variable to the ListController/actionList and if the ListController/actionList returns true, then display the modal window.
Can you tell me how this can be done using Yii2?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-07-08
@azovl

It's sad... to replace this:
on this

<?=\yii\bootstrap\Button::widget([
    'label' => Yii::t('app', 'Add to list'),
    'options' => ['class' => 'btn btn_small btn_green'],
]);?>

at the same time, killing the autocamplite support for class names in the bud, such perversions with attributes, etc. ...
Oh yes ... you also confuse the client code and server code ... What you describe is not resolved by the widget, but by the JS code ...

A
Andkon, 2014-07-08
@Andkon13

It seems to me that Button was inherited from Widget and it said
/**
* @var array the options for the underlying Bootstrap JS plugin.
* Please refer to the corresponding Bootstrap plugin Web page for possible options.
* For example, [this page]( getbootstrap.com/javascript/#modals) shows
* how to use the "Modal" plugin and the supported options (eg "remote").
*/
public $clientOptions = [];
In short: dig in the direction of clientOptions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question