PHP code example of wdmg / yii2-selectinput

1. Go to this page and download the library: Download wdmg/yii2-selectinput 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/ */

    

wdmg / yii2-selectinput example snippets


    
    use wdmg\widgets\SelectInput;
    ...
    
    echo SelectInput::widget([
        'model' => $model,
        'attribute' => 'type',
        'items' => [
            'value' => 'Label',
            ...
        ],
        'options' => [
            'class' => 'form-control'
        ],
        'pluginOptions' => [
            'dropdownClass' => '.dropdown',
            'listClass' => '.dropdown-menu',
            'itemClass' => '.dropdown-item',
            'toggleClass' => '.btn .btn-default .dropdown-toggle',
            'toggleText' => 'Dropdown',
            'toggleCaret' => '<span class="caret"></span>',
            'toggleChange' => true,
            'autocomplete' => false,
            'minInput' => 2
        ]
    ])
    
    

    
    use wdmg\widgets\SelectInput;
    ...
    
    $form = ActiveForm::begin();
    ...
    
    echo $form->field($model, 'type')->widget(SelectInput::class, [
        'items' => [
            'value' => 'Label',
            ...
        ],
        'options' => [
            'class' => 'form-control'
        ],
        'pluginOptions' => [
            'dropdownClass' => '.dropdown',
            'listClass' => '.dropdown-menu',
            'itemClass' => '.dropdown-item',
            'toggleClass' => '.btn .btn-default .dropdown-toggle',
            'toggleText' => 'Dropdown',
            'toggleCaret' => '<span class="caret"></span>',
            'toggleChange' => true,
            'autocomplete' => false,
            'minInput' => 2
        ]
    ]);
    ...
    
    ActiveForm::end();