Blame view

frontend/config/main.php 7.24 KB
298bc0f4   Alexey Boroda   first commit
1
2
3
  <?php
      use artbox\core\components\LanguageRequest;
      use artbox\core\components\SeoComponent;
298bc0f4   Alexey Boroda   first commit
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
      use artbox\core\seo\UrlManager;
      
      $params = array_merge(
          require( __DIR__ . '/../../common/config/params.php' ),
          require( __DIR__ . '/../../common/config/params-local.php' ),
          require( __DIR__ . '/params.php' ),
          require( __DIR__ . '/params-local.php' )
      );
      
      return [
          'id'                  => 'app-frontend',
          'homeUrl'             => '/',
          'basePath'            => dirname(__DIR__),
          'bootstrap'           => [ 'log' ],
          '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',
                      'email',
                      'message',
                  ],
                  'rules'           => [
                      [
                          [ 'email' ],
                          'email',
                      ],
                      [
                          [
                              'email',
                              'name',
                              'message',
                          ],
                          'required',
                      ],
                  ],
                  'labels'          => [
0d556e29   Anastasia   translations
48
49
50
                      'email'   => \Yii::t('app','Email'),
                      'name'    => \Yii::t('app','Name'),
                      'message' => \Yii::t('app','You question'),
298bc0f4   Alexey Boroda   first commit
51
52
53
54
55
56
57
                  ],
                  'inputOptions'    => [
                      'message' => [
                          'type'    => 'textarea',
                          'options' => [],
                      ],
                  ],
0d556e29   Anastasia   translations
58
                  'buttonContent' => \Yii::t('app','Send'),
298bc0f4   Alexey Boroda   first commit
59
60
61
62
63
                  'scenario'        => 'feedback',
                  'sendEmail'       => false,
                  'formId'          => 'feedback-form',
                  'ajax'            => true,
                  'successCallback' => 'function (data) {
c4d70d93   Anastasia   - blog
64
                          document.getElementById("feedback-form").reset();
298bc0f4   Alexey Boroda   first commit
65
66
67
68
69
                                $(".close").click();
                                $(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_");
                                setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){
                                    $(this).removeClass("done_");
                                })}, 4000);
c4d70d93   Anastasia   - blog
70
                                
298bc0f4   Alexey Boroda   first commit
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
                      }',
              ],
  
              'contact' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "artbox\core\models\Feedback",
                  'templateForm' => '<div class="row">{form}</div>',
                  'attributes' => [
                      'name',
                      'email',
                      'phone',
                       'message',
                  ],
                  'rules'      => [
                      [
                          [ 'email' ],
                          'email',
                      ],
                      [
                          [
                              'email',
                              'name',
                              'phone',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
0d556e29   Anastasia   translations
99
100
101
102
                      'email'   => \Yii::t('app','Email'),
                      'name'    => \Yii::t('app', 'Name'),
                      'message' => \Yii::t('app','Message'),
                      'phone'   => \Yii::t('app','Phone')
298bc0f4   Alexey Boroda   first commit
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
                        'template' => '<div class="col-sm-12">{input}</div>'
                      ],
                      'email'   => [
                          'template' => '<div class="col-sm-6">{input}</div>'
                      ],
                      'phone'   => [
                          'template' => '<div class="col-sm-6">{input}</div>'
                      ],
                      'message' => [
                          'type'    => 'textarea',
                          'options' => [],
                          'template' => '<div class="col-sm-12">{input}</div>'
                      ],
                  ],
                  'buttonTemplate'  => '<div class="col-sm-12 text-center">{button}</div>',
                  'buttonOptions'   => [
                    'class' =>   'btn btn-template-main',
                  ],
0d556e29   Anastasia   translations
125
                  'buttonContent'   => '<i class="fa fa-envelope-o"></i>' .\Yii::t('app','Send message'),
298bc0f4   Alexey Boroda   first commit
126
127
128
129
130
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'contact-form',
                  'scenario'        => 'default',
                  'successCallback' => 'function (data) {
c4d70d93   Anastasia   - blog
131
                                document.getElementById("contact-form").reset();
298bc0f4   Alexey Boroda   first commit
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
                                $(".close").click();
                                $(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_");
                                setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){
                                    $(this).removeClass("done_");
                                })}, 4000);
                      }',
                  
              ],
          ],
          'components'          => [
              'request'      => [
                  'class'     => LanguageRequest::className(),
                  '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',
                          ],
                      ],
                  ],
              ],
              'seo'                => [
                  'class' => SeoComponent::className(),
              ],
              'errorHandler' => [
                  'errorAction' => 'site/error',
              ],
              'urlManager'   => [
                  'class'           => UrlManager::className(),
                  'baseUrl'         => '/',
                  'enablePrettyUrl' => true,
                  'showScriptName'  => false,
                  'rules'           => [],
                  'hideDefaultLanguagePrefix' => true,
              ],
          ],
          
          'params'              => $params,
      ];