3133 - Отключение sitemap.xml страниц на анг.

parent 459e70dd
<?php
namespace common\modules\blog\components;
use Yii;
......@@ -25,10 +26,8 @@ class TagBehavior extends Behavior
private function clearPostTags()
{
if($this->owner->postTagAssigns)
{
foreach ($this->owner->postTagAssigns as $tag)
{
if ($this->owner->postTagAssigns) {
foreach ($this->owner->postTagAssigns as $tag) {
$tag->delete();
}
}
......@@ -36,13 +35,11 @@ class TagBehavior extends Behavior
private function insertPostTags()
{
if($this->tags)
{
foreach ($this->tags as $tag)
{
$tags = explode(',', $this->tags);
if (is_array($tags)) {
foreach ($tags as $tag) {
$tg = PostTag::find()->where(['name' => $tag])->one();
if(!$tg)
{
if (!$tg) {
// Убрана возможность создавать новые теги
return false;
// $tg = new PostTag;
......@@ -60,7 +57,7 @@ class TagBehavior extends Behavior
public function eventFind($event)
{
$this->tags = array_keys(ArrayHelper::map($this->owner->postTags, 'name', 'id'));
$this->tags = implode(',', array_keys(ArrayHelper::map($this->owner->postTags, 'name', 'id')));
}
public function Save($event)
......
......@@ -136,6 +136,10 @@ class PostController extends BaseController
{
$model = $this->findModelByUrl($url);
if(!$model->lang || $model->lang->hidden) {
throw new NotFoundHttpException('Page not found!');
}
$this->meta_title = $model->metaTag->title;
$this->meta_description = $model->metaTag->description;
$this->meta_keywords = $model->metaTag->keywords;
......
......@@ -24,7 +24,9 @@ class PageController extends \common\components\BaseController
$model = $this->findDocumentModel($document);
$modelContent = $model->getLang()->one();
if(!$model->lang || $model->lang->hidden) {
throw new NotFoundHttpException('Page not found!');
}
$documentation = $model->lang->html;
$this->meta_title = $model->metaTag->title;
$this->meta_description = $model->metaTag->description;
......
......@@ -110,6 +110,10 @@ class FaqController extends BaseController
{
$model = $this->findModelByUrl($url);
if(!$model->lang || $model->lang->hidden) {
throw new NotFoundHttpException('Page not found!');
}
$this->meta_title = $model->metaTag ? $model->metaTag->title : ' ';
$this->meta_description = $model->metaTag ? $model->metaTag->description : ' ';
$this->meta_keywords = $model->metaTag ? $model->metaTag->keywords : ' ';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment