Skip to content

Commit

Permalink
Add keywords column on article table
Browse files Browse the repository at this point in the history
Not Finished
  • Loading branch information
thecodeholic committed Jan 26, 2017
1 parent f2afe9a commit 6bfe31e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"trntv/yii2-datetime-widget": "^1.0.0",
"trntv/yii2-file-kit": "^1.0.0",
"trntv/yii2-aceeditor": "^2.0",
"omcrn/yii2-base": "^0.1.1"
"omcrn/yii2-base": "^0.1.1",
"bower-asset/bootstrap-tagsinput": "^0.5.0"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use yii\db\Migration;

class m170126_103558_keywords_column_on_article_translation_table extends Migration
{
public function up()
{
$this->addColumn(\centigen\i18ncontent\models\ArticleTranslation::tableName(), 'keywords', \yii\db\Schema::TYPE_STRING."(256)");
}

public function down()
{
$this->dropColumn(\centigen\i18ncontent\models\ArticleTranslation::tableName(), 'keywords');
}

/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
4 changes: 3 additions & 1 deletion models/ArticleTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @property string $meta_title
* @property string $meta_description
* @property string $meta_keywords
* @property string $keywords
*
* @property Article $article
*/
Expand All @@ -41,7 +42,7 @@ public function rules()
[['article_id'], 'integer'],
[['body','short_description'], 'string'],
[['locale'], 'string', 'max' => 15],
[['title', 'meta_title', 'meta_description', 'meta_keywords'], 'string', 'max' => 512]
[['title', 'keywords', 'meta_title', 'meta_description', 'meta_keywords'], 'string', 'max' => 512]
];
}

Expand All @@ -60,6 +61,7 @@ public function attributeLabels()
'meta_title' => Yii::t('i18ncontent', 'Meta Title'),
'meta_description' => Yii::t('i18ncontent', 'Meta Description'),
'meta_keywords' => Yii::t('i18ncontent', 'Meta Keywords'),
'keywords' => Yii::t('i18ncontent', 'Keywords'),
];
}

Expand Down
7 changes: 7 additions & 0 deletions views/article/_tab_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
'name' => "{$className}[$language][title]"
]
])->textInput(['maxlength' => true]) ?>

<?php echo $form->field($model, 'keywords', [
'inputOptions' => [
'name' => "{$className}[$language][keywords]"
]
])->textInput(['maxlength' => true]) ?>

<?php echo $form->field($model, 'short_description')->widget(
\yii\imperavi\Widget::className(),
[
Expand Down

0 comments on commit 6bfe31e

Please sign in to comment.