LanguageDynamicForm without init values in children User tests in common Console run fixmaster
@ -0,0 +1,15 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 27.07.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
namespace common\modules\blog\entities\queries; |
||||||
|
|
||||||
|
use yii\db\ActiveQuery; |
||||||
|
use core\components\LanguageTranslateTrait; |
||||||
|
|
||||||
|
class BlogCategoryQuery extends ActiveQuery |
||||||
|
{ |
||||||
|
use LanguageTranslateTrait; |
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
use yii\db\Migration; |
||||||
|
|
||||||
|
/** |
||||||
|
* Handles the creation of table `blog_post_lng`. |
||||||
|
*/ |
||||||
|
class m180828_190314_create_blog_post_lng_table extends Migration |
||||||
|
{ |
||||||
|
/** |
||||||
|
* {@inheritdoc} |
||||||
|
*/ |
||||||
|
public function safeUp() |
||||||
|
{ |
||||||
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||||||
|
|
||||||
|
$this->createTable('{{%blog_posts_lng}}', [ |
||||||
|
'id' => $this->primaryKey(), |
||||||
|
'blog_post_id' => $this->integer()->notNull(), |
||||||
|
'language' => $this->string(6)->notNull(), |
||||||
|
'title' => $this->string()->notNull(), |
||||||
|
'description' => $this->text(), |
||||||
|
'content' => 'MEDIUMTEXT', |
||||||
|
'meta_title' => $this->string(255), |
||||||
|
'meta_description' => $this->text(), |
||||||
|
'meta_keywords' => $this->string(255), |
||||||
|
], $tableOptions); |
||||||
|
|
||||||
|
$this->createIndex('idx_blog_posts_lng_language', '{{%blog_posts_lng}}', 'language'); |
||||||
|
$this->createIndex('idx_blog_posts_lng_blog_post_id', '{{%blog_posts_lng}}', 'blog_post_id'); |
||||||
|
$this->addForeignKey('frg_blog_posts_lng_blog_posts_blog_post_id_id', '{{%blog_posts_lng}}', 'blog_post_id', '{{%blog_posts}}', 'id', 'CASCADE', 'CASCADE'); |
||||||
|
|
||||||
|
$this->dropColumn('{{%blog_posts}}', 'title'); |
||||||
|
$this->dropColumn('{{%blog_posts}}', 'description'); |
||||||
|
$this->dropColumn('{{%blog_posts}}', 'content'); |
||||||
|
$this->dropColumn('{{%blog_posts}}', 'meta_json'); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* {@inheritdoc} |
||||||
|
*/ |
||||||
|
public function safeDown() |
||||||
|
{ |
||||||
|
$this->addColumn('{{%blog_posts}}', 'title', $this->string(255)->notNull()); |
||||||
|
$this->addColumn('{{%blog_posts}}', 'description', $this->text()); |
||||||
|
$this->addColumn('{{%blog_posts}}', 'description', 'MEDIUMTEXT'); |
||||||
|
$this->addColumn('{{%blog_posts}}', 'meta_json', $this->text()); |
||||||
|
|
||||||
|
$this->dropForeignKey('frg_blog_posts_lng_blog_posts_blog_post_id_id', '{{%blog_posts_lng}}'); |
||||||
|
$this->dropIndex('idx_blog_posts_lng_blog_post_id', '{{%blog_posts_lng}}'); |
||||||
|
$this->dropIndex('idx_blog_posts_lng_language', '{{%blog_posts_lng}}'); |
||||||
|
$this->dropTable('{{%blog_posts_lng}}'); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,55 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
use yii\db\Migration; |
||||||
|
|
||||||
|
/** |
||||||
|
* Handles the creation of table `blog_categories_lng`. |
||||||
|
*/ |
||||||
|
class m180830_163050_create_blog_categories_lng_table extends Migration |
||||||
|
{ |
||||||
|
/** |
||||||
|
* {@inheritdoc} |
||||||
|
*/ |
||||||
|
public function safeUp() |
||||||
|
{ |
||||||
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||||||
|
|
||||||
|
$this->createTable('{{%blog_categories_lng}}', [ |
||||||
|
'id' => $this->primaryKey(), |
||||||
|
'blog_category_id' => $this->integer()->notNull(), |
||||||
|
'language' => $this->string(6)->notNull(), |
||||||
|
'name' => $this->string()->notNull(), |
||||||
|
'title' => $this->string(), |
||||||
|
'description' => $this->text(), |
||||||
|
'meta_title' => $this->string(255), |
||||||
|
'meta_description' => $this->text(), |
||||||
|
'meta_keywords' => $this->string(255), |
||||||
|
], $tableOptions); |
||||||
|
|
||||||
|
$this->createIndex('idx_blog_categories_lng_language', '{{%blog_categories_lng}}', 'language'); |
||||||
|
$this->createIndex('idx_blog_categories_lng_blog_category_id', '{{%blog_categories_lng}}', 'blog_category_id'); |
||||||
|
$this->addForeignKey('frg_blog_categories_lng_blog_categories_blog_category_id_id', '{{%blog_categories_lng}}', 'blog_category_id', '{{%blog_categories}}', 'id', 'CASCADE', 'CASCADE'); |
||||||
|
|
||||||
|
$this->dropColumn('{{%blog_categories}}', 'title'); |
||||||
|
$this->dropColumn('{{%blog_categories}}', 'description'); |
||||||
|
$this->dropColumn('{{%blog_categories}}', 'name'); |
||||||
|
$this->dropColumn('{{%blog_categories}}', 'meta_json'); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* {@inheritdoc} |
||||||
|
*/ |
||||||
|
public function safeDown() |
||||||
|
{ |
||||||
|
$this->dropForeignKey('frg_blog_categories_lng_blog_categories_blog_category_id_id', '{{%blog_categories_lng}}'); |
||||||
|
$this->dropIndex('idx_blog_categories_lng_blog_category_id', '{{%blog_categories_lng}}'); |
||||||
|
$this->dropIndex('idx_blog_categories_lng_language', '{{%blog_categories_lng}}'); |
||||||
|
|
||||||
|
$this->dropTable('{{%blog_categories_lng}}'); |
||||||
|
|
||||||
|
$this->addColumn('{{%blog_categories}}', 'title', $this->string(255)); |
||||||
|
$this->addColumn('{{%blog_categories}}', 'name', $this->string(255)->notNull()); |
||||||
|
$this->addColumn('{{%blog_categories}}', 'description', $this->text()); |
||||||
|
$this->addColumn('{{%blog_categories}}', 'meta_json', 'LONGTEXT NOT NULL'); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 28.08.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
use zertex\ckeditor\CKEditor; |
||||||
|
|
||||||
|
/** |
||||||
|
* @var $this \yii\web\View |
||||||
|
* @var $form \yii\widgets\ActiveForm |
||||||
|
* @var $model \common\modules\blog\forms\BlogPostForm |
||||||
|
* @var $language string |
||||||
|
*/ |
||||||
|
|
||||||
|
$postfix = $language == Yii::$app->params['defaultLanguage'] ? '' : '_' . $language; |
||||||
|
?> |
||||||
|
|
||||||
|
<div class="box box-default"> |
||||||
|
<div class="box-body"> |
||||||
|
<?= $form->field($model, 'name' . $postfix)->textInput(['maxlength' => true]) ?> |
||||||
|
<?= $form->field($model, 'title' . $postfix)->textInput(['maxlength' => true]) ?> |
||||||
|
<?= $form->field($model, 'description' . $postfix)->widget(CKEditor::class) ?> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<div class="box box-default"> |
||||||
|
<div class="box-header with-border"><?= Yii::t('blog', 'SEO') ?></div>
|
||||||
|
<div class="box-body"> |
||||||
|
<?= $form->field($model, 'meta_title' . $postfix)->textInput() ?> |
||||||
|
<?= $form->field($model, 'meta_description' . $postfix)->textarea(['rows' => 2]) ?> |
||||||
|
<?= $form->field($model, 'meta_keywords' . $postfix)->textInput() ?> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,77 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 25.08.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
use yii\widgets\DetailView; |
||||||
|
use common\modules\blog\entities\BlogCategory; |
||||||
|
|
||||||
|
/** |
||||||
|
* @var $this \yii\web\View |
||||||
|
* @var $category BlogCategory |
||||||
|
* @var $language string |
||||||
|
*/ |
||||||
|
|
||||||
|
?> |
||||||
|
|
||||||
|
<?= DetailView::widget([ |
||||||
|
'model' => $category, |
||||||
|
'attributes' => [ |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'Name'), |
||||||
|
'value' => function(BlogCategory $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->name; |
||||||
|
} |
||||||
|
], |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'Title'), |
||||||
|
'value' => function(BlogCategory $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->title; |
||||||
|
} |
||||||
|
], |
||||||
|
], |
||||||
|
]) ?> |
||||||
|
|
||||||
|
<div class="box"> |
||||||
|
<div class="box-header with-border"><?= Yii::t('blog', 'SEO') ?></div>
|
||||||
|
<div class="box-body"> |
||||||
|
|
||||||
|
<?= DetailView::widget([ |
||||||
|
'model' => $category, |
||||||
|
'attributes' => [ |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'META Title'), |
||||||
|
'value' => function(BlogCategory $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->meta_title; |
||||||
|
} |
||||||
|
], |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'META Description'), |
||||||
|
'value' => function(BlogCategory $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->meta_description; |
||||||
|
} |
||||||
|
], |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'META Keywords'), |
||||||
|
'value' => function(BlogCategory $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->meta_keywords; |
||||||
|
} |
||||||
|
], |
||||||
|
], |
||||||
|
]) ?> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="box"> |
||||||
|
<div class="box-header with-border"><?= Yii::t('blog', 'Description') ?></div>
|
||||||
|
<div class="box-body"> |
||||||
|
<?= Yii::$app->formatter->asHtml($category->findTranslation($language)->description, [ |
||||||
|
'Attr.AllowedRel' => array('nofollow'), |
||||||
|
'HTML.SafeObject' => true, |
||||||
|
'Output.FlashCompat' => true, |
||||||
|
'HTML.SafeIframe' => true, |
||||||
|
'URI.SafeIframeRegexp'=>'%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%', |
||||||
|
]) ?> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,35 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 28.08.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
use zertex\ckeditor\CKEditor; |
||||||
|
|
||||||
|
/** |
||||||
|
* @var $this \yii\web\View |
||||||
|
* @var $form \yii\widgets\ActiveForm |
||||||
|
* @var $model \common\modules\blog\forms\BlogPostForm |
||||||
|
* @var $language string |
||||||
|
*/ |
||||||
|
|
||||||
|
$postfix = $language == Yii::$app->params['defaultLanguage'] ? '' : '_' . $language; |
||||||
|
?> |
||||||
|
|
||||||
|
<div class="box box-default"> |
||||||
|
<div class="box-body"> |
||||||
|
<?= $form->field($model, 'title' . $postfix)->textInput(['maxlength' => true]) ?> |
||||||
|
<?= $form->field($model, 'description' . $postfix)->textarea(['rows' => 5]) ?> |
||||||
|
<?= $form->field($model, 'content' . $postfix)->widget(CKEditor::class) ?> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<div class="box box-default"> |
||||||
|
<div class="box-header with-border"><?= Yii::t('blog', 'SEO') ?></div>
|
||||||
|
<div class="box-body"> |
||||||
|
<?= $form->field($model, 'meta_title' . $postfix)->textInput() ?> |
||||||
|
<?= $form->field($model, 'meta_description' . $postfix)->textarea(['rows' => 2]) ?> |
||||||
|
<?= $form->field($model, 'meta_keywords' . $postfix)->textInput() ?> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,78 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 25.08.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
use yii\widgets\DetailView; |
||||||
|
use common\modules\blog\entities\BlogPost; |
||||||
|
|
||||||
|
/** |
||||||
|
* @var $this \yii\web\View |
||||||
|
* @var $post \common\modules\blog\entities\BlogPost |
||||||
|
* @var $language string |
||||||
|
*/ |
||||||
|
|
||||||
|
?> |
||||||
|
|
||||||
|
<?= DetailView::widget([ |
||||||
|
'model' => $post, |
||||||
|
'attributes' => [ |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'Title'), |
||||||
|
'value' => function(BlogPost $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->title; |
||||||
|
} |
||||||
|
], |
||||||
|
], |
||||||
|
]) ?> |
||||||
|
|
||||||
|
<div class="box"> |
||||||
|
<div class="box-header with-border"><?= Yii::t('blog', 'SEO') ?></div>
|
||||||
|
<div class="box-body"> |
||||||
|
|
||||||
|
<?= DetailView::widget([ |
||||||
|
'model' => $post, |
||||||
|
'attributes' => [ |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'META Title'), |
||||||
|
'value' => function(BlogPost $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->meta_title; |
||||||
|
} |
||||||
|
], |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'META Description'), |
||||||
|
'value' => function(BlogPost $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->meta_description; |
||||||
|
} |
||||||
|
], |
||||||
|
[ |
||||||
|
'label' => Yii::t('blog', 'META Keywords'), |
||||||
|
'value' => function(BlogPost $entity) use ($language) { |
||||||
|
return $entity->findTranslation($language)->meta_keywords; |
||||||
|
} |
||||||
|
], |
||||||
|
], |
||||||
|
]) ?> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="box"> |
||||||
|
<div class="box-header with-border"><?= Yii::t('blog', 'Description') ?></div>
|
||||||
|
<div class="box-body"> |
||||||
|
<?= Yii::$app->formatter->asNtext($post->findTranslation($language)->description) ?> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="box"> |
||||||
|
<div class="box-header with-border"><?= Yii::t('blog', 'Content') ?></div>
|
||||||
|
<div class="box-body"> |
||||||
|
<?= Yii::$app->formatter->asHtml($post->findTranslation($language)->content, [ |
||||||
|
'Attr.AllowedRel' => array('nofollow'), |
||||||
|
'HTML.SafeObject' => true, |
||||||
|
'Output.FlashCompat' => true, |
||||||
|
'HTML.SafeIframe' => true, |
||||||
|
'URI.SafeIframeRegexp'=>'%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%', |
||||||
|
]) ?> |
||||||
|
</div> |
||||||
|
</div> |
@ -1,14 +1,49 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
return [ |
return [ |
||||||
[ |
'user1' => [ |
||||||
'username' => 'bayer.hudson', |
"id" => 1, |
||||||
'auth_key' => 'HP187Mvq7Mmm3CTU80dLkGmni_FUH_lR', |
"username" => "Error202", |
||||||
//password_0 |
"auth_key" => "I4MJAUm8ZZ4rennRmwhjfeZ7xV2-FpYn", |
||||||
'password_hash' => '$2y$13$EjaPFBnZOQsHdGuHI.xvhuDp1fHpo8hKRSk6yshqa9c5EG8s3C3lO', |
"password_hash" => '$2y$13$Q/XqSZs.6Y5KYmKf5OhpEOGWoB1GfBjxg8DTTnvionrJrCkezgyZe', |
||||||
'password_reset_token' => 'ExzkCOaYc1L8IOBs4wdTGGbgNiG3Wz1I_1402312317', |
"password_reset_token" => null, |
||||||
'created_at' => '1402312317', |
"email" => "error-202@mail.ru", |
||||||
'updated_at' => '1402312317', |
"email_confirm_token" => null, |
||||||
'email' => 'nicole.paucek@schultz.info', |
"status" => 10, |
||||||
|
"created_at" => 1516021751, |
||||||
|
"updated_at" => 1530816306, |
||||||
|
"user_pic" => "avatar_e188db6330ceab81865b3996f7bbb3d6_300.png", |
||||||
|
"backend_language" => "ru", |
||||||
|
"frontend_language" => "ru", |
||||||
|
], |
||||||
|
'user2' => [ |
||||||
|
"id" => 17, |
||||||
|
"username" => "Error203", |
||||||
|
"auth_key" => "wW7PWDP0yUvGVzEqy3dZepb0tj19ejv6", |
||||||
|
"password_hash" => '$2y$13$Spf7/iHOj3aJARSORST4s.blouBXtUPLzMf7sD4AX9akSK1URGkfe', |
||||||
|
"password_reset_token" => null, |
||||||
|
"email" => "error-202@yandex.ru", |
||||||
|
"email_confirm_token" => null, |
||||||
|
"status" => 10, |
||||||
|
"created_at" => 1518122129, |
||||||
|
"updated_at" => 1518127758, |
||||||
|
"user_pic" => null, |
||||||
|
"backend_language" => "ru", |
||||||
|
"frontend_language" => "ru", |
||||||
|
], |
||||||
|
'user3' => [ |
||||||
|
"id" => 18, |
||||||
|
"username" => "zz", |
||||||
|
"auth_key" => "JbLkAlfA7jQ0XxbaWxUEPWQCzsVZ9gn8", |
||||||
|
"password_hash" => '$2y$13$gyDo.ax9O962rq9pfh6sX.ZHrZ05cTZNAaX8VEMBL7n6UPsMr/vHa', |
||||||
|
"password_reset_token" => null, |
||||||
|
"email" => "zz@morework.ru", |
||||||
|
"email_confirm_token" => "AcNTOgIMhefCq5tQaOyUqEIeIPLFqFdY", |
||||||
|
"status" => 0, |
||||||
|
"created_at" => 1518157352, |
||||||
|
"updated_at" => 1518157352, |
||||||
|
"user_pic" => null, |
||||||
|
"backend_language" => "ru", |
||||||
|
"frontend_language" => "ru", |
||||||
], |
], |
||||||
]; |
]; |
||||||
|
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 924 KiB |
Before Width: | Height: | Size: 240 KiB |