PHP code example of dersonsena / yii2-widget-inputsaddon

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

    

dersonsena / yii2-widget-inputsaddon example snippets


// the widget usege WITH ActiveForm and model. Minimal configuration
echo $form->field($model, 'IMO_VAL_ARE')
    ->widget(EmailAddon::className());

// the widget usege WITHOUT ActiveForm or model
echo EmailAddon::widget([
    'name' => 'person_email',
    'value' => '[email protected]'
]);

// the example for costumization
echo $form->field($model, 'email_field')
    ->widget(EmailAddon::className(), [
        'side' => EmailAddon::RIGHT_SIDE,
        'size' => EmailAddon::SIZE_LARGE,
        'icon' => 'fa fa-envelope' // default is: glyphicon glyphicon-envelope
        'forceEmailType' => true, // Force the input field to be email type. Available only for EmailAddon
        'options' => [
            'placeholder' => 'Type your email...'
        ]
    ])

// Text instead icon
echo $form->field($model, 'email_field')
    ->widget(EmailAddon::className(), [
        'icon' => '@'
        'useIconText' => true
    ])

echo $form->field($model, 'person_id')
    ->widget(ButtonsAddon::className(), [
        'buttons' => [
            Html::button("<i class='glyphicon glyphicon-search'></i>", ['class' => 'btn btn-primary']),
            Html::button("Add", ['class' => 'btn btn-default', 'onclick' => 'alert("Add")']),
            Html::button("Remove", ['class' => 'btn btn-danger'])
        ]
    ])

$ php composer.phar