Commit 9270bbe654b30bf606b03eaa2410a9cc28916ca2
1 parent
79a72f42
seo h1 fix
Showing
1 changed file
with
7 additions
and
8 deletions
Show diff stats
frontend/widgets/Seo.php
... | ... | @@ -101,9 +101,9 @@ class Seo extends Widget |
101 | 101 | |
102 | 102 | $filter = \Yii::$app->request->get('filters', []); |
103 | 103 | |
104 | - $default = $this->selectSeoData(self::H1); | |
104 | + $default = $this->selectSeoData(self::H1, $priority); | |
105 | 105 | |
106 | - if ($default != $this->{self::H1}) { | |
106 | + if (($default != $this->{self::H1}) || $priority == 1) { | |
107 | 107 | |
108 | 108 | return $default; |
109 | 109 | |
... | ... | @@ -319,12 +319,10 @@ class Seo extends Widget |
319 | 319 | return $query->one(); |
320 | 320 | } |
321 | 321 | |
322 | - | |
323 | 322 | protected function findSeoByDynamicForFilters(){ |
324 | 323 | return SeoDynamic::find()->joinWith('seoCategory')->where(['param' =>'filters'])->one(); |
325 | 324 | } |
326 | 325 | |
327 | - | |
328 | 326 | protected function getViewData() |
329 | 327 | { |
330 | 328 | $params = $this->getView()->params; |
... | ... | @@ -335,7 +333,7 @@ class Seo extends Widget |
335 | 333 | } |
336 | 334 | } |
337 | 335 | |
338 | - protected function selectSeoData($param) | |
336 | + protected function selectSeoData($param, &$priority) | |
339 | 337 | { |
340 | 338 | $result = ''; |
341 | 339 | |
... | ... | @@ -344,9 +342,12 @@ class Seo extends Widget |
344 | 342 | if ($widgetData instanceof \common\models\Seo) { |
345 | 343 | |
346 | 344 | $result = $widgetData->$param; |
345 | + $priority = 1; | |
347 | 346 | |
348 | 347 | } else if (!empty($this->$param)) { |
348 | + | |
349 | 349 | $result = $this->$param; |
350 | + $priority = 2; | |
350 | 351 | |
351 | 352 | } else { |
352 | 353 | |
... | ... | @@ -355,6 +356,7 @@ class Seo extends Widget |
355 | 356 | if ($widgetData instanceof SeoDynamic) { |
356 | 357 | |
357 | 358 | $result = $widgetData->$param; |
359 | + $priority = 3; | |
358 | 360 | |
359 | 361 | } |
360 | 362 | |
... | ... | @@ -404,7 +406,6 @@ class Seo extends Widget |
404 | 406 | |
405 | 407 | } |
406 | 408 | |
407 | - | |
408 | 409 | public function getNameString($array){ |
409 | 410 | $row = ''; |
410 | 411 | foreach($array as $name => $field){ |
... | ... | @@ -471,6 +472,4 @@ class Seo extends Widget |
471 | 472 | |
472 | 473 | } |
473 | 474 | |
474 | - | |
475 | - | |
476 | 475 | } |
477 | 476 | \ No newline at end of file | ... | ... |