PHP code example of dbfernandes / yii2-icomp-toggle

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

    

dbfernandes / yii2-icomp-toggle example snippets


use dbfernandes\icomp\ICompToggleWidget;

//...
echo $form->field($model, 'attribute')->widget(ICompToggleWidget::className());
//...

use dbfernandes\icomp\ICompToggleWidget;

//...
IcompToggleWidget::widget([
    'name' => 'is_enabled',
    'value' => false,
]);
//...

ICompToggleWidget::widget([

    /**
     * Wrapper tag name. If set to false no tag will be rendered
     */
    'container' => 'div',

    /**
     * Wrapper HTML attributes
     */
    'containerOptions' => [],
    
    /**
     * Label when checkbox is checked
     */
    'labelEnabled' => 'Yes',
    
    /**
     * Label when checkbox is not checked
     */
     'labelDisabled' => 'No',
     
     /**
      * Additional javascript options to Bootstrap Toggle plugin 
      */
      'pluginOptions' => [],
]);

$ php composer.phar