We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8153ced commit 3a916b0Copy full SHA for 3a916b0
src/MultiLangUrlManager.php
@@ -17,17 +17,22 @@
17
*/
18
class MultiLangUrlManager extends UrlManager
19
{
20
+ /**
21
+ *
22
+ */
23
+ const LANG_PARAM_NAME = "lang";
24
+
25
/**
26
* @param array|string $params
27
* @return string
28
29
public function createUrl($params)
30
- if (isset($params['lang'])) {
31
+ if (isset($params[static::LANG_PARAM_NAME])) {
32
//Если указан идентификатор языка, то делаем попытку найти язык в БД,
33
//иначе работаем с языком по умолчанию
- $lang = $params['lang'];
- unset($params['lang']);
34
+ $lang = $params[static::LANG_PARAM_NAME];
35
+ unset($params[static::LANG_PARAM_NAME]);
36
} else {
37
//Если не указан параметр языка, то работаем с текущим языком
38
$lang = \Yii::$app->language;
0 commit comments