AjaxController.php 603 Bytes
<?php
namespace common\modules\blog\controllers;

use common\models\Language;
use common\modules\blog\models\ArticleCategoryLang;
use yii\web\Controller;
use yii\web\NotFoundHttpException;

class AjaxController extends Controller
{
    public function actionCategoryForm($lang_id)
    {
        $model = Language::findOne($lang_id);
        if(!$model) {
            throw new NotFoundHttpException('Language not found');
        }
        $category_lang = new ArticleCategoryLang();
        return $this->renderPartial('_category_form', ['model' => $model, 'category_lang' => $category_lang]);
    }
}