Skip to content

Commit 688c14a

Browse files
Canurl only for urlManager->enablePrettyUrl
1 parent 350a3cb commit 688c14a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
CHANGELOG
22
==============
33

4+
2.1.6.2
5+
-----------------
6+
* Canurl only for urlManager->enablePrettyUrl
7+
48
2.1.6.1
59
-----------------
610
* Update logs

src/CmsSeoComponent.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ public function bootstrap($application)
276276
* Стандартная инициализация canurl
277277
*/
278278
Event::on(Controller::class, Controller::EVENT_BEFORE_ACTION, function (ActionEvent $e) {
279-
$this->_initDefaultCanUrl();
279+
if (\Yii::$app->urlManager->enablePrettyUrl) {
280+
$this->_initDefaultCanUrl();
281+
}
282+
280283

281284
/**
282285
* Редирект 404 ошибок
@@ -312,7 +315,6 @@ public function bootstrap($application)
312315

313316
protected function _initDefaultCanUrl()
314317
{
315-
316318
/**
317319
* Канурл может быть отключен вовсе
318320
*/
@@ -412,7 +414,7 @@ public function _addCanurlParams(WidgetEvent $e)
412414

413415
public function _isTrigerEventCanUrl()
414416
{
415-
if (\Yii::$app->controller && in_array(\Yii::$app->controller->uniqueId, [
417+
if (\Yii::$app->urlManager->enablePrettyUrl && \Yii::$app->controller && in_array(\Yii::$app->controller->uniqueId, [
416418
'cms/tree',
417419
'cms/content-element',
418420
'savedFilters/saved-filters',

0 commit comments

Comments
 (0)