add priority in Content

parent 99ed8e7c
...@@ -71,7 +71,7 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -71,7 +71,7 @@ class CoContent extends \common\components\ActiveRecordModel
'loc' => Url::to($model->url, true), 'loc' => Url::to($model->url, true),
'lastmod' => date('c', $model->updated_at), 'lastmod' => date('c', $model->updated_at),
'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY, 'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY,
'priority' => 0.8 'priority' => $model->priority
]; ];
} }
], ],
...@@ -95,7 +95,7 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -95,7 +95,7 @@ class CoContent extends \common\components\ActiveRecordModel
[['image'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'], [['image'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'],
[['url'], 'required'], [['url'], 'required'],
[['url'], 'string', 'max' => 250], [['url'], 'string', 'max' => 250],
[['category_id'], 'safe'] [['category_id', 'priority'], 'safe']
]; ];
} }
...@@ -110,6 +110,7 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -110,6 +110,7 @@ class CoContent extends \common\components\ActiveRecordModel
'url' => Yii::t('content', 'Url'), 'url' => Yii::t('content', 'Url'),
'name' => Yii::t('content', 'Name'), 'name' => Yii::t('content', 'Name'),
'image' => 'Превью', 'image' => 'Превью',
'priority' => 'Приоритет в Sitemap',
'title' => Yii::t('content', 'Title'), 'title' => Yii::t('content', 'Title'),
'text' => Yii::t('content', 'Content'), 'text' => Yii::t('content', 'Content'),
'active' => Yii::t('content', 'Active'), 'active' => Yii::t('content', 'Active'),
......
...@@ -70,6 +70,8 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all(); ...@@ -70,6 +70,8 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all();
'label' => ' ' 'label' => ' '
], false); ?> ], false); ?>
<?= $form->field($model, 'priority')->textInput(['maxlength' => 3])->hint('По умолчанию: 0.8') ?>
<?php if($model->preview) <?php if($model->preview)
{ {
echo Html::img(\Yii::$app->params['frontUrl'] . CoContent::PHOTO_FOLDER . $model->preview); echo Html::img(\Yii::$app->params['frontUrl'] . CoContent::PHOTO_FOLDER . $model->preview);
......
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160205_104801_add_column_co_content extends Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->addColumn('co_content', 'priority', "FLOAT( 3, 1 ) DEFAULT '0.8' AFTER url");
}
public function safeDown()
{
$this->dropColumn('co_content', 'priority');
}
}
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