PHP code example of soless / yii2-jquery-tageditor-widget

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

    

soless / yii2-jquery-tageditor-widget example snippets


   echo $form->field($model, 'selectedTags')->widget('soless\tageditor\TagEditorWidget', [
	'availableTags' => ['firstTag', 'secondTag', 'thirdTag', ],
        'tagEditorOptions' => [
            'forceLowercase' => false,
            'autocomplete' => [
                'source' => \yii\helpers\Url::toRoute(['/tag/suggest'])
            ],
        ]
    ]) 

     public function actionSuggest($term) {
	Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

        return \yii\helpers\ArrayHelper::getColumn(
	    \common\models\Tag::find()
	    ->select('title')
	    ->filterWhere(['like', 'title', $term.'%', false])
	    ->all(), 
	    'title'
	);
    }