/** * Suggests tags based on the current user input. * This is called via AJAX when the user is entering the tags input. */ public function actionSuggestTags() { if (isset($_GET['term']) && ($keyword = trim($_GET['term'])) !== '') { $model = new Tag(); $tags = $model->suggestTags($keyword); if ($tags !== array()) { echo Json::encode($tags); } } }