PHP code example of andrew72ru / yii2-bootstrap-slider

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

    

andrew72ru / yii2-bootstrap-slider example snippets


$form->field($model, 'property')
    ->widget(\andrew72ru\slider\Slider::className(), [
        'min'           => 100,     // Find min value form you model if you want
        'max'           => 1000,    // Find max value form you model if you want
        'value1'        => 150,     // Optional, value to first slider init. Refer to min if not set
        'value2'        => 350,     // Optional, value to second slider init. Refer to max if not set
        'step'          => 1,       // Optional, refer to 1 if not set,
        'options'       => [
            // Avaliable all seiyria/bootstrap-slider options
        ]
        'clientEvents'  => [
            'slide' => 'function(e) {console.log(e)}',
            'slideStart' => 'function(e) {console.log(e)}',
            'slideStop' => 'function(e) {console.log(e)}',
            'change' => 'function(e) {console.log(e)}',
            'slideEnabled' => 'function(e) {console.log(e)}',
            'slideDisabled' => 'function(e) {console.log(e)}',
        ]
    ])

// Value – is a string value of form field 
if(strpos($value, ',') !== false)
    $where = ['between', 'value', explode(',', $value)[0], explode(',', $value)[1]];

php composer.phar