diff --git a/frontend/widgets/Seo.php b/frontend/widgets/Seo.php index 9308010..7e47929 100755 --- a/frontend/widgets/Seo.php +++ b/frontend/widgets/Seo.php @@ -101,9 +101,9 @@ class Seo extends Widget $filter = \Yii::$app->request->get('filters', []); - $default = $this->selectSeoData(self::H1); + $default = $this->selectSeoData(self::H1, $priority); - if ($default != $this->{self::H1}) { + if (($default != $this->{self::H1}) || $priority == 1) { return $default; @@ -319,12 +319,10 @@ class Seo extends Widget return $query->one(); } - protected function findSeoByDynamicForFilters(){ return SeoDynamic::find()->joinWith('seoCategory')->where(['param' =>'filters'])->one(); } - protected function getViewData() { $params = $this->getView()->params; @@ -335,7 +333,7 @@ class Seo extends Widget } } - protected function selectSeoData($param) + protected function selectSeoData($param, &$priority) { $result = ''; @@ -344,9 +342,12 @@ class Seo extends Widget if ($widgetData instanceof \common\models\Seo) { $result = $widgetData->$param; + $priority = 1; } else if (!empty($this->$param)) { + $result = $this->$param; + $priority = 2; } else { @@ -355,6 +356,7 @@ class Seo extends Widget if ($widgetData instanceof SeoDynamic) { $result = $widgetData->$param; + $priority = 3; } @@ -404,7 +406,6 @@ class Seo extends Widget } - public function getNameString($array){ $row = ''; foreach($array as $name => $field){ @@ -471,6 +472,4 @@ class Seo extends Widget } - - } \ No newline at end of file -- libgit2 0.21.4