Browse Source

Revert FrontendController

master
Egorka 7 years ago
parent
commit
ead0a3e0e7
  1. 4
      common/modules/blog/controllers/PostController.php
  2. 4
      common/modules/pages/controllers/PageController.php
  3. 14
      frontend/bootstrap/SetUp.php
  4. 32
      frontend/components/FrontendController.php
  5. 4
      frontend/controllers/ContactController.php
  6. 4
      frontend/controllers/PostController.php
  7. 10
      frontend/controllers/SiteController.php
  8. 6
      frontend/controllers/account/ProfileController.php

4
common/modules/blog/controllers/PostController.php

@ -11,16 +11,16 @@ use common\modules\blog\repositories\read\BlogPostReadRepository;
use common\modules\blog\repositories\read\BlogTagReadRepository;
use common\modules\blog\services\BlogCommentService;
use core\entities\Meta;
use frontend\components\FrontendController;
use Yii;
use yii\base\Security;
use yii\data\ActiveDataProvider;
use yii\helpers\FileHelper;
use yii\helpers\Json;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\AccessControl;
class PostController extends Controller
class PostController extends FrontendController
{
public $layout = 'blog';

4
common/modules/pages/controllers/PageController.php

@ -3,12 +3,12 @@
namespace common\modules\pages\controllers;
use common\modules\pages\repositories\read\PageReadRepository;
use yii\web\Controller;
use frontend\components\FrontendController;
use yii\web\NotFoundHttpException;
use yii\filters\AccessControl;
class PageController extends Controller
class PageController extends FrontendController
{
private $pages;

14
frontend/bootstrap/SetUp.php

@ -33,19 +33,5 @@ class SetUp implements BootstrapInterface
'<_c:[\w\-]+>/<_a:[\w-]+>' => '<_c>/<_a>',
'<_c:[\w\-]+>/<id:\d+>/<_a:[\w\-]+>' => '<_c>/<_a>',
]);
// Set site theme
$theme = isset($app->params['settings']['design']['theme']) ? $app->params['settings']['design']['theme'] : 'start';
$app->view->theme = new Theme([
'basePath' => '@webroot/themes/' . $theme,
'baseUrl' => '@web/themes/' . $theme,
'pathMap' => [
'@common/modules' => '@webroot/themes/' . $theme . '/modules',
'@frontend/views' => '@webroot/themes/' . $theme,
'@frontend/widgets' => '@webroot/themes/' . $theme . '/widgets',
],
]);
}
}

32
frontend/components/FrontendController.php

@ -0,0 +1,32 @@
<?php
/**
* Created by Error202
* Date: 23.07.2018
*/
namespace frontend\components;
use yii\base\Theme;
use yii\web\Controller;
use Yii;
class FrontendController extends Controller
{
public function init() {
parent::init();
$theme = isset(Yii::$app->params['settings']['design']['theme']) ? Yii::$app->params['settings']['design']['theme'] : 'start';
Yii::$app->view->theme = new Theme([
'basePath' => '@webroot/themes/' . $theme,
'baseUrl' => '@web/themes/' . $theme,
'pathMap' => [
'@common/modules' => '@webroot/themes/' . $theme . '/modules',
'@frontend/views' => '@webroot/themes/' . $theme,
'@frontend/widgets' => '@webroot/themes/' . $theme . '/widgets',
],
]);
}
}

4
frontend/controllers/ContactController.php

@ -2,11 +2,11 @@
namespace frontend\controllers;
use core\services\ContactService;
use frontend\components\FrontendController;
use Yii;
use core\forms\ContactForm;
use yii\web\Controller;
class ContactController extends Controller
class ContactController extends FrontendController
{
public $layout = 'contacts';

4
frontend/controllers/PostController.php

@ -8,13 +8,13 @@ use core\repositories\post\read\PostCategoryReadRepository;
use core\repositories\post\read\PostReadRepository;
use core\repositories\post\read\PostTagReadRepository;
use core\services\post\PostCommentService;
use frontend\components\FrontendController;
use Yii;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\AccessControl;
class PostController extends Controller
class PostController extends FrontendController
{
public $layout = 'post';

10
frontend/controllers/SiteController.php

@ -3,16 +3,16 @@ namespace frontend\controllers;
use core\forms\SubscribeForm;
use core\services\newsletter\Newsletter;
use frontend\components\FrontendController;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use frontend\components\SiteAccess;
use Yii;
use yii\web\Controller;
/**
* Site controller
*/
class SiteController extends Controller
class SiteController extends FrontendController
{
public $newletter;
@ -28,7 +28,7 @@ class SiteController extends Controller
{
return [
'access' => [
'class' => AccessControl::className(),
'class' => AccessControl::class,
'only' => ['subscribe'],
'rules' => [
[
@ -38,12 +38,12 @@ class SiteController extends Controller
],
],
'verbs' => [
'class' => VerbFilter::className(),
'class' => VerbFilter::class,
'actions' => [
'logout' => ['post'],
],
],
SiteAccess::className(),
SiteAccess::class,
];
}

6
frontend/controllers/account/ProfileController.php

@ -7,7 +7,7 @@
namespace frontend\controllers\account;
use yii\web\Controller;
use frontend\components\FrontendController;
use core\services\user\ProfileService;
use core\forms\user\ProfileEditForm;
use core\entities\user\User;
@ -15,7 +15,7 @@ use yii\web\NotFoundHttpException;
use yii\filters\AccessControl;
use Yii;
class ProfileController extends Controller
class ProfileController extends FrontendController
{
public $layout = 'profile';
@ -31,7 +31,7 @@ class ProfileController extends Controller
{
return [
'access' => [
'class' => AccessControl::className(),
'class' => AccessControl::class,
'only' => ['index'],
'rules' => [
[

Loading…
Cancel
Save