PHP code example of wbraganca / yii2-selectivity

1. Go to this page and download the library: Download wbraganca/yii2-selectivity library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wbraganca / yii2-selectivity example snippets




use wbraganca\selectivity\SelectivityWidget;

<?= $form->field($model, 'city', [
        'options' => ['class' => 'selectivity-container form-group']
    ])->widget(SelectivityWidget::classname(), [
    'options' => [
        'prompt' => ''
    ],
    'pluginOptions' => [
        'allowClear' => true,
        'data' => ['Rio de Janeiro', 'São Paulo'],
        'placeholder' => 'No city selected'
    ],
    'template' => '<div class="input-group">' .
        '{input}' .
        '<div class="input-group-append">' .
        '<span class="input-group-btn">' .
        '<button class="btn btn-success" type="button">' .
        '<i class="fa fa-plus"></i>' .
        '</button>' .
        '</div>' .
        '</span>' .
        '</div>'
])