function () {
$pathInfo = Yii::$app->request->pathInfo;
$query = Yii::$app->request->queryString;
if (!empty($pathInfo) && substr($pathInfo, -1) === '/') {
$url = '/' . substr($pathInfo, 0, -1);
if ($query) {
$url .= '?' . $query;
}
Yii::$app->response->redirect($url, 301);
}
},
'id' => 'app-frontend',
'homeUrl' => '/',
'basePath' => dirname(__DIR__),
'bootstrap' => [ 'log','assetsAutoCompress' ],
'controllerNamespace' => 'frontend\controllers',
'container' => [
'singletons' => [
'artbox\core\services\Languages' =>'artbox\core\services\Languages',
]
],
'modules' => [
'feedback' => [
'class' => 'artbox\core\forms\Module',
'activeRecord' => "artbox\core\models\Feedback",
'attributes' => [
'name',
'phone',
'message',
],
'rules' => [
[
[
'name',
'phone',
],
'required',
]
],
'labels' => [
'name' => \Yii::t('app','Name'),
'message' => \Yii::t('app','Message'),
'phone' => \Yii::t('app','Phone'),
],
'inputOptions' => [
'name' => [
'template' => '
{input}
'
],
'phone' => [
'template' => '{input}
'
],
'message' => [
'type' => 'textarea',
'options' => [],
'template' => '{input}
'
],
],
'buttonTemplate' => '{button}
',
'buttonOptions' => [],
'buttonContent' => 'Send',
'sendEmail' => false,
'ajax' => true,
'formId' => 'feedback-form',
'scenario' => 'callback',
'successCallback' => 'function (data) {
document.getElementById("feedback-form").reset();
$("#modal_close").click();
if (data.status == "success"){
document.getElementById("feedback-form").reset();
success();
var data = $("#feedback-form").data(\'yiiActiveForm\');
data.validated = false;
}
}',
],
'contact' => [
'class' => 'artbox\core\forms\Module',
'activeRecord' => "artbox\core\models\Feedback",
'attributes' => [
'name',
'email',
'message',
],
'rules' => [
[
[
'name',
'email',
],
'required',
]
],
'labels' => [
'name' => \Yii::t('app','Name'),
'message' => \Yii::t('app','Yours question'),
'phone' => \Yii::t('app','Email'),
],
'inputOptions' => [
'name' => [
'template' => '{input}
'
],
'email' => [
'template' => '{input}
'
],
'message' => [
'type' => 'textarea',
'options' => [],
'template' => '{input}
'
],
],
'buttonTemplate' => '{button}
',
'buttonOptions' => [],
'buttonContent' => 'Send',
'sendEmail' => false,
'ajax' => true,
'formId' => 'contact-form',
'scenario' => 'feedback',
'successCallback' => 'function (data) {
document.getElementById("contact-form").reset();
if (data.status == "success"){
document.getElementById("contact-form").reset();
success();
var data = $("#contact-form").data(\'yiiActiveForm\');
data.validated = false;
}
}',
],
'comments' => [
'class' => 'artbox\core\forms\Module',
'activeRecord' => "common\models\Comment",
'attributes' => [
'name',
'email',
'comment',
'entity_id',
'entity'
],
'rules' => [
[
[
'name',
'email',
],
'required',
]
],
'labels' => [
'name' => 'ФИО',
'email' => 'Email',
'comment' => 'Ваш отзыв',
'entity_id' => false,
'entity' => false
],
'inputOptions' => [
'name' => [
'template' => '{input}
'
],
'email' => [
'template' => '{input}
'
],
'comment' => [
'type' => 'textarea',
'options' => [],
'template' => '{input}
'
],
],
'buttonTemplate' => '',
'buttonOptions' => [],
'buttonContent' => 'Отправить отзыв',
'sendEmail' => false,
'ajax' => true,
'formId' => 'comment-form',
'scenario' => 'default',
'successCallback' => 'function (data) {
document.getElementById("comment-form").reset();
var data = $("#comment-form").data(\'yiiActiveForm\');
$("#comment-form").find(".submit-close-c-a span").click();
$("#comment-form").parent().parent().parent().find(".service-c-a-btns").after("Ваш отзыв появиться после проверки модератором
")
data.validated = false;
}',
],
'questions' => [
'class' => 'artbox\core\forms\Module',
'activeRecord' => "common\models\Question",
'attributes' => [
'name',
'email',
'question',
'service_id'
],
'rules' => [
[
[
'name',
'email',
],
'required',
]
],
'labels' => [
'name' => 'ФИО',
'email' => 'Email',
'question' => 'Ваш вопрос',
'service_id' => false
],
'inputOptions' => [
'name' => [
'template' => '{input}
'
],
'email' => [
'template' => '{input}
'
],
'question' => [
'type' => 'textarea',
'options' => [],
'template' => '{input}
'
],
],
'buttonTemplate' => '',
'buttonOptions' => [],
'buttonContent' => 'Отправить вопрос',
'sendEmail' => false,
'ajax' => true,
'formId' => 'question-form',
'scenario' => 'question',
'successCallback' => 'function (data) {
document.getElementById("question-form").reset();
var data = $("#question-form").data(\'yiiActiveForm\');
$("#question-form").find(".submit-close-c-a span").click();
$("#question-form").parent().parent().parent().find(".service-c-a-btns").after("Спасибо за Вваш вопрос. Мы обязательно на него ответим
")
data.validated = false;
}',
],
'visit' => [
'class' => 'artbox\core\forms\Module',
'activeRecord' => "common\models\Visit",
'attributes' => [
'name',
'phone',
'email',
'message',
'entity',
'entity_id'
],
'rules' => [
[
[
'phone',
],
'required',
]
],
'labels' => [
'name' =>\Yii::t('app','FIO'),
'email' =>\Yii::t('app','Email'),
'phone' => \Yii::t('app','Phone'),
'message' => \Yii::t('app','Message'),
'entity_id' => false,
'entity' => false
],
'inputOptions' => [
'entity' => [
'type' => 'hiddenInput'
],
'entity_id' => [
'type' => 'hiddenInput'
],
'name' => [
'template' => '{input}
'
],
'email' => [
'template' => '{input}
'
],
'phone' => [
'template' => '{input}
',
'options' => [
'placeholder' => '(0__)___-__-__'
]
],
'message' => [
'type' => 'textarea',
'options' => ['cols' => 30, 'rows'=> 10],
'template' => '{input}
'
],
],
'buttonTemplate' => '{button}
',
'buttonOptions' => [],
'buttonContent' => 'Отправить',
'sendEmail' => false,
'ajax' => true,
'formId' => 'visit-form',
'scenario' => 'default',
'successCallback' => 'function (data) {
document.getElementById("visit-form").reset();
var data = $("#visit-form").data(\'yiiActiveForm\');
data.validated = false;
success();
}',
],
],
'components' => [
'assetManager' => [
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'basePath' => '@webroot',
'baseUrl' => '@web',
'css' => [],
],
'frontend\assets\ArtboxModalAsset' => [
'basePath' => '@webroot',
'baseUrl' => '@web',
'css' => [],
],
],
'appendTimestamp' => true,
],
'request' => [
'csrfParam' => '_csrf-frontend',
'baseUrl' => '',
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_identity-frontend',
'httpOnly' => true,
],
],
'session' => [
// this is the name of the session cookie used for login on the frontend
'name' => 'advanced-frontend',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => [
'error',
'warning',
],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'class' => UrlManager::className(),
'baseUrl' => '/',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
'hideDefaultLanguagePrefix' => true,
],
'assetsAutoCompress' => [
'class' => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
'enabled' => false,
'readFileTimeout' => 3,
//Time in seconds for reading each asset file
'jsCompress' => true,
//Enable minification js in html code
'jsCompressFlaggedComments' => true,
//Cut comments during processing js
'cssCompress' => true,
//Enable minification css in html code
'cssFileCompile' => true,
//Turning association css files
'cssFileRemouteCompile' => false,
//Trying to get css files to which the specified path as the remote file, skchat him to her.
'cssFileCompress' => true,
//Enable compression and processing before being stored in the css file
'cssFileBottom' => false,
//Moving down the page css files
'cssFileBottomLoadOnJs' => false,
//Transfer css file down the page and uploading them using js
'jsFileCompile' => true,
//Turning association js files
'jsFileRemouteCompile' => false,
//Trying to get a js files to which the specified path as the remote file, skchat him to her.
'jsFileCompress' => true,
//Enable compression and processing js before saving a file
'jsFileCompressFlaggedComments' => true,
//Cut comments during processing js
'htmlCompress' => true,
//Enable compression html
'noIncludeJsFilesOnPjax' => true,
//Do not connect the js files when all pjax requests
'htmlCompressOptions' => //options for compressing output result
[
'extra' => false,
//use more compact algorithm
'no-comments' => true
//cut all the html comments
],
],
],
'params' => $params,
];