diff --git a/src/Core/Content/Blog/Author/AuthorDefinition.php b/src/Core/Content/Blog/Author/AuthorDefinition.php
index 6b55db5..17cb791 100644
--- a/src/Core/Content/Blog/Author/AuthorDefinition.php
+++ b/src/Core/Content/Blog/Author/AuthorDefinition.php
@@ -8,6 +8,7 @@
namespace Magefan\Blog\Core\Content\Blog\Author;
+use Magefan\Blog\Core\Content\Blog\Author\AuthorTranslation\AuthorTranslationDefinition;
use Magefan\Blog\Core\Content\Blog\Post\PostDefinition;
use Shopware\Core\Content\Media\MediaDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
@@ -61,11 +62,10 @@ protected function defineFields(): FieldCollection
return new FieldCollection([
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()),
(new IdField('admin_user_id', 'adminUserId'))->addFlags(new Required()),
- (new BoolField('is_active', 'isActive')),
+ new FkField('media_id', 'mediaId', MediaDefinition::class),
+
(new StringField('firstname', 'firstname')),
(new StringField('lastname', 'lastname')),
- (new StringField('email', 'email')),
- (new StringField('role', 'role')),
(new StringField('facebook_page_url', 'facebookPageUrl')),
(new StringField('twitter_page_url', 'twitterPageUrl')),
(new StringField('instagram_page_url', 'instagramPageUrl')),
@@ -79,6 +79,9 @@ protected function defineFields(): FieldCollection
(new LongTextField('content', 'content')),
(new LongTextField('short_content', 'short_content')),
(new StringField('featured_img', 'featuredImg')),
+ (new BoolField('is_active', 'isActive')),
+ (new StringField('email', 'email')),
+ (new StringField('role', 'role')),
(new StringField('page_layout', 'pageLayout')),
(new StringField('layout_update_xml', 'layoutUpdateXml')),
(new StringField('custom_theme', 'customTheme')),
@@ -91,7 +94,8 @@ protected function defineFields(): FieldCollection
(new IdField('media_id', 'mediaId')),
(new StringField('created_at', 'createdAt')),
(new StringField('updated_at', 'updatedAt')),
- new FkField('media_id', 'mediaId', MediaDefinition::class),
+
+ // associations
new OneToManyAssociationField('authorPosts', PostDefinition::class, 'author_id'),
(new OneToOneAssociationField('media', 'media_id', 'id', MediaDefinition::class, true))->addFlags(new ApiAware()),
]);
diff --git a/src/Core/Content/Blog/Category/CategoryDefinition.php b/src/Core/Content/Blog/Category/CategoryDefinition.php
index 4ea5042..5871383 100644
--- a/src/Core/Content/Blog/Category/CategoryDefinition.php
+++ b/src/Core/Content/Blog/Category/CategoryDefinition.php
@@ -8,15 +8,19 @@
namespace Magefan\Blog\Core\Content\Blog\Category;
+use Magefan\Blog\Core\Content\Blog\Category\CategoryTranslation\CategoryTranslationDefinition;
use Magefan\Blog\Core\Content\Blog\Post\PostDefinition;
use Magefan\Blog\Core\Content\Blog\PostCategory\PostCategoryDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\Field\DateField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\CascadeDelete;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Inherited;
use Shopware\Core\Framework\DataAbstractionLayer\Field\IntField;
-use Shopware\Core\Framework\DataAbstractionLayer\Field\LongTextField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToManyAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToOneAssociationField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslatedField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslationsAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
@@ -59,16 +63,18 @@ protected function defineFields(): FieldCollection
{
return new FieldCollection([
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()),
- (new StringField('title', 'title'))->addFlags(new Required()),
- (new StringField('meta_title', 'metaTitle')),
- (new StringField('meta_keywords', 'metaKeywords')),
- (new StringField('meta_description', 'metaDescription')),
- (new StringField('identifier', 'identifier')),
- (new LongTextField('content_heading', 'contentHeading')),
- (new LongTextField('content', 'content')),
- (new StringField('path', 'path')),
+
+ //translations
+ (new TranslatedField('title'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaTitle'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaKeywords'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaDescription'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('contentHeading'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('content'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('path'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('identifier'))->addFlags(new ApiAware(), new Inherited()),
+
(new IntField('position', 'position')),
- (new StringField('path', 'path')),
(new StringField('posts_sort_by', 'postsSortBy')),
(new BoolField('include_in_menu', 'includeInMenu')),
(new BoolField('is_active', 'isActive')),
@@ -84,7 +90,10 @@ protected function defineFields(): FieldCollection
(new StringField('posts_list_template', 'postsListTemplate')),
(new StringField('created_at', 'createdAt')),
(new StringField('updated_at', 'updatedAt')),
+
+ // associations
(new OneToOneAssociationField('blogCategories', 'id', 'category_id', PostCategoryDefinition::class, false))->addFlags(new CascadeDelete()), new ManyToManyAssociationField('blogPosts', PostDefinition::class, PostCategoryDefinition::class, 'category_id', 'post_id'),
+ (new TranslationsAssociationField(CategoryTranslationDefinition::class, 'magefanblog_category_id'))->addFlags(new ApiAware(), new Required())
]);
}
}
diff --git a/src/Core/Content/Blog/Category/CategoryTranslation/CategoryTranslationCollection.php b/src/Core/Content/Blog/Category/CategoryTranslation/CategoryTranslationCollection.php
new file mode 100644
index 0000000..afe348c
--- /dev/null
+++ b/src/Core/Content/Blog/Category/CategoryTranslation/CategoryTranslationCollection.php
@@ -0,0 +1,31 @@
+addFlags(new ApiAware(), new Required()),
+ (new StringField('title', 'title'))->addFlags(new Required()),
+ (new StringField('meta_title', 'metaTitle')),
+ (new StringField('meta_keywords', 'metaKeywords')),
+ (new StringField('meta_description', 'metaDescription')),
+ (new LongTextField('content_heading', 'contentHeading')),
+ (new LongTextField('content', 'content')),
+ (new StringField('identifier', 'identifier')),
+ (new StringField('path', 'path')),
+ ]);
+ }
+}
diff --git a/src/Core/Content/Blog/Category/CategoryTranslation/CategoryTranslationEntity.php b/src/Core/Content/Blog/Category/CategoryTranslation/CategoryTranslationEntity.php
new file mode 100644
index 0000000..dcfd73f
--- /dev/null
+++ b/src/Core/Content/Blog/Category/CategoryTranslation/CategoryTranslationEntity.php
@@ -0,0 +1,18 @@
+addFilter(new EqualsFilter('identifier', $identifier))
+ ->addFilter(new EqualsFilter('id', $identifier))
->addFilter(new EqualsFilter('isActive', 1))
->addAssociation('blogCategories')
->addAssociation('blogPosts');
@@ -97,8 +97,9 @@ public function getPostsByCategory($category, $request, $context): EntityCollect
->addAssociation('blogCategories')
->addAssociation('postTags')
->addAssociation('postAuthor')
+ ->addFilter(new EqualsFilter('isActive', 1))
->addSorting(new FieldSorting('postTags'. '.' . $sortBy, $sorting))
- ->addFilter(new EqualsFilter('postCategories.identifier', $category->getIdentifier()))
+ ->addFilter(new EqualsFilter('postCategories.id', $category->getId()))
->setLimit((bool)$category->getPostsPerPage() ? $category->getPostsPerPage() : $limit)
->setOffset($pageOffset);
diff --git a/src/Core/Content/Blog/DataResolver/BlogListResolver.php b/src/Core/Content/Blog/DataResolver/BlogListResolver.php
index 0056219..791cce5 100644
--- a/src/Core/Content/Blog/DataResolver/BlogListResolver.php
+++ b/src/Core/Content/Blog/DataResolver/BlogListResolver.php
@@ -18,15 +18,6 @@
class BlogListResolver
{
- /**
- * @var EntityRepository
- */
- private EntityRepository $blogAuthorRepository;
-
- /**
- * @var EntityRepository
- */
- private EntityRepository $blogCategoryRepository;
/**
* @var SystemConfigService
diff --git a/src/Core/Content/Blog/DataResolver/BlogPostResolver.php b/src/Core/Content/Blog/DataResolver/BlogPostResolver.php
index a827c3f..a965b5d 100644
--- a/src/Core/Content/Blog/DataResolver/BlogPostResolver.php
+++ b/src/Core/Content/Blog/DataResolver/BlogPostResolver.php
@@ -43,7 +43,7 @@ public function __construct(
public function getPost($identifier, $context)
{
$postCriteria = (new Criteria())
- ->addFilter(new EqualsFilter('identifier', $identifier))
+ ->addFilter(new EqualsFilter('id', $identifier))
->addFilter(new EqualsFilter('isActive', 1))
->addAssociation('postCategories')
->addAssociation('postTags')
diff --git a/src/Core/Content/Blog/DataResolver/BlogTagResolver.php b/src/Core/Content/Blog/DataResolver/BlogTagResolver.php
index b699d7a..5778b2f 100644
--- a/src/Core/Content/Blog/DataResolver/BlogTagResolver.php
+++ b/src/Core/Content/Blog/DataResolver/BlogTagResolver.php
@@ -52,7 +52,7 @@ public function getTag($tagId, $context)
{
$criteria = (new Criteria())
->addFilter(new EqualsFilter('isActive', 1))
- ->addFilter(new EqualsFilter('identifier', $tagId))
+ ->addFilter(new EqualsFilter('id', $tagId))
->addAssociation('postTags');
$author = $this->blogTagRepository->search($criteria, $context->getContext())->getEntities()->first();
diff --git a/src/Core/Content/Blog/Post/PostDefinition.php b/src/Core/Content/Blog/Post/PostDefinition.php
index c51c229..eb3173f 100644
--- a/src/Core/Content/Blog/Post/PostDefinition.php
+++ b/src/Core/Content/Blog/Post/PostDefinition.php
@@ -11,6 +11,7 @@
use Magefan\Blog\Core\Content\Blog\Author\AuthorDefinition;
use Magefan\Blog\Core\Content\Blog\Category\CategoryDefinition;
use Magefan\Blog\Core\Content\Blog\Comment\CommentDefinition;
+use Magefan\Blog\Core\Content\Blog\Post\PostTranslation\PostTranslationDefinition;
use Magefan\Blog\Core\Content\Blog\PostCategory\PostCategoryDefinition;
use Magefan\Blog\Core\Content\Blog\PostTag\PostTagDefinition;
use Magefan\Blog\Core\Content\Blog\Tag\TagDefinition;
@@ -20,12 +21,14 @@
use Shopware\Core\Framework\DataAbstractionLayer\Field\FkField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\AllowHtml;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Inherited;
use Shopware\Core\Framework\DataAbstractionLayer\Field\IntField;
-use Shopware\Core\Framework\DataAbstractionLayer\Field\LongTextField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToManyAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToManyAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToOneAssociationField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslatedField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslationsAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
@@ -68,33 +71,40 @@ protected function defineFields(): FieldCollection
{
return new FieldCollection([
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()),
- (new StringField('title', 'title'))->addFlags(new Required()),
- (new StringField('meta_title', 'metaTitle')),
- (new StringField('meta_keywords', 'metaKeywords')),
- (new StringField('meta_description', 'metaDescription')),
- (new LongTextField('content_heading', 'contentHeading'))->addFlags(new AllowHtml()),
- (new LongTextField('content', 'content'))->addFlags(new AllowHtml()),
- (new StringField('identifier', 'identifier'))->addFlags(new Required()),
+ new FkField('media_id', 'mediaId', MediaDefinition::class),
+ new FkField('author_id', 'authorId', AuthorDefinition::class),
+
+ //translations
+ (new TranslatedField('title'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaTitle'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaKeywords'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaDescription'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('contentHeading'))->addFlags(new ApiAware(), new AllowHtml()),
+ (new TranslatedField('content'))->addFlags(new ApiAware(), new AllowHtml()),
+ (new TranslatedField('featuredImg'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('featuredImgAlt'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('ogTitle'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('ogDescription'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('ogImg'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('ogType'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('identifier'))->addFlags(new ApiAware(), new Inherited()),
+
(new IntField('position', 'position')),
- (new StringField('featured_img', 'featuredImg')),
- (new StringField('featured_img_alt', 'featuredImgAlt')),
(new BoolField('include_in_recent', 'includeInRecent')),
- (new StringField('og_title', 'ogTitle')),
- (new StringField('og_description', 'ogDescription')),
- (new IdField('og_img', 'ogImg')),
- (new StringField('og_type', 'ogType')),
(new DateTimeField('publish_time', 'publishTime')),
(new StringField('created_at', 'createdAt')),
(new StringField('updated_at', 'updatedAt')),
(new DateTimeField('publish_time', 'publishTime')),
(new BoolField('is_active', 'isActive')),
- new FkField('media_id', 'mediaId', MediaDefinition::class),
+
+ // associations
(new OneToOneAssociationField('media', 'media_id', 'id', MediaDefinition::class, true))->addFlags(new ApiAware()),
new FkField('author_id', 'authorId', AuthorDefinition::class),
new ManyToOneAssociationField('postAuthor', 'author_id', AuthorDefinition::class, 'id'),
new ManyToManyAssociationField('postTags', TagDefinition::class, PostTagDefinition::class, 'post_id', 'tag_id'),
new ManyToManyAssociationField('postCategories', CategoryDefinition::class, PostCategoryDefinition::class, 'post_id', 'category_id'),
- new OneToManyAssociationField('postComments', CommentDefinition::class, 'post_id')
+ new OneToManyAssociationField('postComments', CommentDefinition::class, 'post_id'),
+ (new TranslationsAssociationField(PostTranslationDefinition::class, 'magefanblog_post_id'))->addFlags(new ApiAware(), new Required())
]);
}
}
diff --git a/src/Core/Content/Blog/Post/PostEntity.php b/src/Core/Content/Blog/Post/PostEntity.php
index d7b5f09..128ec6a 100644
--- a/src/Core/Content/Blog/Post/PostEntity.php
+++ b/src/Core/Content/Blog/Post/PostEntity.php
@@ -375,7 +375,12 @@ public function setOgType($ogType)
*/
public function getContentHeading(): ?string
{
- return $this->contentHeading;
+ $desc = $this->contentHeading;
+ if (!$desc) {
+ $desc = $this->content;
+ }
+
+ return $desc;
}
/**
diff --git a/src/Core/Content/Blog/Post/PostTranslation/PostTranslationCollection.php b/src/Core/Content/Blog/Post/PostTranslation/PostTranslationCollection.php
new file mode 100644
index 0000000..9750b5c
--- /dev/null
+++ b/src/Core/Content/Blog/Post/PostTranslation/PostTranslationCollection.php
@@ -0,0 +1,31 @@
+addFlags(new ApiAware(), new Required()),
+
+ (new StringField('title', 'title'))->addFlags(new ApiAware(), new Required()),
+ (new StringField('meta_title', 'metaTitle'))->addFlags(new ApiAware()),
+ (new StringField('meta_keywords', 'metaKeywords'))->addFlags(new ApiAware()),
+ (new StringField('meta_description', 'metaDescription'))->addFlags(new ApiAware()),
+ (new LongTextField('content_heading', 'contentHeading'))->addFlags(new ApiAware(), new AllowHtml()),
+ (new LongTextField('content', 'content'))->addFlags(new ApiAware(), new AllowHtml()),
+ (new StringField('featured_img', 'featuredImg'))->addFlags(new ApiAware()),
+ (new StringField('featured_img_alt', 'featuredImgAlt'))->addFlags(new ApiAware()),
+ (new StringField('og_title', 'ogTitle'))->addFlags(new ApiAware()),
+ (new StringField('og_description', 'ogDescription'))->addFlags(new ApiAware()),
+ (new StringField('og_img', 'ogImg'))->addFlags(new ApiAware()),
+ (new StringField('og_type', 'ogType'))->addFlags(new ApiAware()),
+ (new StringField('identifier', 'identifier'))->addFlags(new Required()),
+ (new StringField('created_at', 'createdAt'))->addFlags(new ApiAware()),
+ (new StringField('updated_at', 'updatedAt'))->addFlags(new ApiAware()),
+ ]);
+ }
+}
diff --git a/src/Core/Content/Blog/Post/PostTranslation/PostTranslationEntity.php b/src/Core/Content/Blog/Post/PostTranslation/PostTranslationEntity.php
new file mode 100644
index 0000000..21ce555
--- /dev/null
+++ b/src/Core/Content/Blog/Post/PostTranslation/PostTranslationEntity.php
@@ -0,0 +1,440 @@
+title;
+ }
+
+ /**
+ * @param $title
+ * @return void
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getMetaTitle(): ?string
+ {
+ return $this->metaTitle;
+ }
+
+ /**
+ * @param $metaTitle
+ * @return void
+ */
+ public function setMetaTitle($metaTitle)
+ {
+ $this->metaTitle = $metaTitle;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getMetaKeywords(): ?string
+ {
+ return $this->metaKeywords;
+ }
+
+ /**
+ * @param $metaKeywords
+ * @return void
+ */
+ public function setMetaKeywords($metaKeywords)
+ {
+ $this->metaKeywords = $metaKeywords;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getMetaDescription(): ?string
+ {
+ $desc = $this->metaDescription;
+ if (!$desc) {
+ $desc = $this->getContentHeading() ?: '';
+ $desc = str_replace(['
', '
'], [' ', ''], $desc);
+ }
+
+ $desc = strip_tags($desc);
+ if (mb_strlen($desc) > 200) {
+ $desc = mb_substr($desc, 0, 200);
+ }
+
+ return trim($desc);
+ }
+
+ /**
+ * @param $metaDescription
+ * @return void
+ */
+ public function setMetaDescription($metaDescription)
+ {
+ $this->metaDescription = $metaDescription;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getIdentifier(): ?string
+ {
+ return $this->identifier;
+ }
+
+ /**
+ * @param $identifier
+ * @return void
+ */
+ public function setIdentifier($identifier)
+ {
+ $this->identifier = $identifier;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getOgTitle(): ?string
+ {
+ $title = $this->ogTitle;
+ if (!$title) {
+ $title = $this->getMetaTitle();
+ }
+
+ return $title ? trim($title) : '';
+ }
+
+ /**
+ * @param $ogTitle
+ * @return void
+ */
+ public function setOgTitle($ogTitle)
+ {
+ $this->ogTitle = $ogTitle;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getOgDescription(): ?string
+ {
+ $desc = $this->ogDescription;
+ if (!$desc) {
+ $desc = $this->getMetaDescription();
+ } else {
+ $desc = strip_tags($desc);
+ if (mb_strlen($desc) > 300) {
+ $desc = mb_substr($desc, 0, 300);
+ }
+ }
+
+ return trim(html_entity_decode($desc));
+ }
+
+ /**
+ * @param $ogDescription
+ * @return void
+ */
+ public function setOgDescription($ogDescription)
+ {
+ $this->ogDescription = $ogDescription;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getOgImg(): ?string
+ {
+ $img = $this->ogImg;
+ if (!$img) {
+ $img = $this->getFeaturedImg();
+ }
+
+ return $img;
+ }
+
+ /**
+ * @param $ogImg
+ * @return void
+ */
+ public function setOgImg($ogImg)
+ {
+ $this->ogImg = $ogImg;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getOgType(): ?string
+ {
+ $type = $this->ogType;
+ if (!$type) {
+ $type = 'article';
+ }
+
+ return trim($type);
+ }
+
+ /**
+ * @param $ogType
+ * @return void
+ */
+ public function setOgType($ogType)
+ {
+ $this->ogType = $ogType;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getContentHeading(): ?string
+ {
+ return $this->contentHeading;
+ }
+
+ /**
+ * @param $contentHeading
+ * @return void
+ */
+ public function setContentHeading($contentHeading)
+ {
+ $this->contentHeading = $contentHeading;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getContent(): ?string
+ {
+ return $this->content;
+ }
+
+ /**
+ * @param $content
+ * @return void
+ */
+ public function setContent($content)
+ {
+ $this->content = $content;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getFeaturedImg(): ?string
+ {
+ return $this->featuredImg;
+ }
+
+ /**
+ * @param $featuredImg
+ * @return void
+ */
+ public function setFeaturedImg($featuredImg)
+ {
+ $this->featuredImg = $featuredImg;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getFeaturedImgAlt(): ?string
+ {
+ return $this->featuredImgAlt;
+ }
+
+ /**
+ * @param $featuredImgAlt
+ * @return void
+ */
+ public function setFeaturedImgAlt($featuredImgAlt)
+ {
+ $this->featuredImgAlt = $featuredImgAlt;
+ }
+}
diff --git a/src/Core/Content/Blog/Sitemap/Provider/BlogUrlProvider.php b/src/Core/Content/Blog/Sitemap/Provider/BlogUrlProvider.php
index a8b9cff..f3d01ea 100644
--- a/src/Core/Content/Blog/Sitemap/Provider/BlogUrlProvider.php
+++ b/src/Core/Content/Blog/Sitemap/Provider/BlogUrlProvider.php
@@ -169,7 +169,7 @@ protected function getBlogCategories($limit, $offset, $context)
$blogCategoryUrl->setIdentifier($blogCategoryEntity->getId());
$blogCategoryUrl->setLoc(
$this->router->generate('frontend.blog.category',
- ['identifier' => $blogCategoryEntity->getIdentifier()],
+ ['id' => $blogCategoryEntity->getId()],
UrlGeneratorInterface::ABSOLUTE_PATH)
);
diff --git a/src/Core/Content/Blog/Tag/TagDefinition.php b/src/Core/Content/Blog/Tag/TagDefinition.php
index fd1f5f7..cb1272d 100644
--- a/src/Core/Content/Blog/Tag/TagDefinition.php
+++ b/src/Core/Content/Blog/Tag/TagDefinition.php
@@ -10,11 +10,16 @@
use Magefan\Blog\Core\Content\Blog\Post\PostDefinition;
use Magefan\Blog\Core\Content\Blog\PostTag\PostTagDefinition;
+use Magefan\Blog\Core\Content\Blog\Tag\TagTranslation\TagTranslationDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\Field\DateField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Inherited;
use Shopware\Core\Framework\DataAbstractionLayer\Field\IntField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\LongTextField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToManyAssociationField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslatedField;
+use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslationsAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
@@ -57,16 +62,18 @@ protected function defineFields(): FieldCollection
{
return new FieldCollection([
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()),
- (new StringField('title', 'title'))->addFlags(new Required()),
- (new StringField('meta_robots', 'metaRobots')),
- (new StringField('meta_description', 'metaDescription')),
- (new StringField('meta_keywords', 'metaKeywords')),
- (new StringField('meta_title', 'metaTitle')),
- (new LongTextField('content', 'content')),
- (new StringField('identifier', 'identifier')),
+
+ //translations
+ (new TranslatedField('title'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaRobots'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaDescription'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaKeywords'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('metaTitle'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('content'))->addFlags(new ApiAware(), new Inherited()),
+ (new TranslatedField('identifier'))->addFlags(new ApiAware(), new Inherited()),
+
(new StringField('page_layout', 'pageLayout')),
(new BoolField('is_active', 'isActive')),
- (new StringField('content', 'content')),
(new StringField('layout_update_xml', 'layoutUpdateXml')),
(new StringField('custom_theme', 'customTheme')),
(new StringField('custom_layout', 'customLayout')),
@@ -77,6 +84,8 @@ protected function defineFields(): FieldCollection
(new StringField('posts_list_template', 'postsListTemplate')),
(new DateField('created_at', 'createdAt')),
(new DateField('updated_at', 'updatedAt')),
+
+ // associations
new ManyToManyAssociationField(
'postTags',
PostDefinition::class,
@@ -84,6 +93,10 @@ protected function defineFields(): FieldCollection
'tag_id',
'post_id'
),
+ (new TranslationsAssociationField(
+ TagTranslationDefinition::class,
+ 'magefanblog_tag_id')
+ )->addFlags(new ApiAware(), new Required())
]);
}
}
diff --git a/src/Core/Content/Blog/Tag/TagTranslation/TagTranslationCollection.php b/src/Core/Content/Blog/Tag/TagTranslation/TagTranslationCollection.php
new file mode 100644
index 0000000..00779f0
--- /dev/null
+++ b/src/Core/Content/Blog/Tag/TagTranslation/TagTranslationCollection.php
@@ -0,0 +1,31 @@
+addFlags(new ApiAware(), new Required()),
+ (new StringField('title', 'title'))->addFlags(new Required()),
+ (new StringField('meta_robots', 'metaRobots')),
+ (new StringField('meta_description', 'metaDescription')),
+ (new StringField('meta_keywords', 'metaKeywords')),
+ (new StringField('meta_title', 'metaTitle')),
+ (new LongTextField('content', 'content')),
+ (new StringField('identifier', 'identifier')),
+ (new StringField('created_at', 'createdAt')),
+ (new StringField('updated_at', 'updatedAt')),
+ ]);
+ }
+}
diff --git a/src/Core/Content/Blog/Tag/TagTranslation/TagTranslationEntity.php b/src/Core/Content/Blog/Tag/TagTranslation/TagTranslationEntity.php
new file mode 100644
index 0000000..1d8e275
--- /dev/null
+++ b/src/Core/Content/Blog/Tag/TagTranslation/TagTranslationEntity.php
@@ -0,0 +1,19 @@
+executeStatement('SET FOREIGN_KEY_CHECKS=0;');
$connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_author`');
$connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_category`');
+ $connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_category_translation`');
$connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_comment`');
$connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_post`');
+ $connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_post_translation`');
$connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_post_category`');
$connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_post_tag`');
$connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_tag`');
+ $connection->executeStatement('DROP TABLE IF EXISTS `magefanblog_tag_translation`');
+ $connection->executeStatement("DELETE FROM seo_url_template WHERE entity_name LIKE 'magefanblog_%';");
+ $connection->executeStatement("DELETE FROM seo_url WHERE route_name LIKE 'frontend.blog%';");
$connection->executeStatement('SET FOREIGN_KEY_CHECKS=1;');
}
@@ -102,10 +107,12 @@ public function activate(ActivateContext $activateContext): void
'SELECT HEX(id),`include_in_menu`,`is_active` FROM `magefanblog_category` WHERE id = :id',
['id' => Uuid::fromHexToBytes($blogCategory->getId())]
)->fetchAll();
- $categoryRepository->update(
- [['id' => $blogCategory->getId(), 'active' => (bool)($status[0]['include_in_menu'] && $status[0]['is_active'])]]
- , $context
- );
+ if (isset($status[0])) {
+ $categoryRepository->update(
+ [['id' => $blogCategory->getId(), 'active' => (bool)($status[0]['include_in_menu'] && $status[0]['is_active'])]]
+ , $context
+ );
+ }
}
}
}
diff --git a/src/Migration/Migration1663319539CreateBlogPostTable.php b/src/Migration/Migration1663319539CreateBlogPostTable.php
index f4c7cbc..140e16a 100644
--- a/src/Migration/Migration1663319539CreateBlogPostTable.php
+++ b/src/Migration/Migration1663319539CreateBlogPostTable.php
@@ -35,22 +35,9 @@ public function update(Connection $connection): void
'
CREATE TABLE `magefanblog_post` (
`id` binary(16) NOT NULL COMMENT "Post ID",
- `title` varchar(255) NOT NULL COMMENT "Post Title",
- `meta_title` varchar(255) DEFAULT NULL COMMENT "Post Meta Title",
- `meta_keywords` text COMMENT "Post Meta Keywords",
- `meta_description` text COMMENT "Post Meta Description",
- `identifier` varchar(100) DEFAULT NULL COMMENT "Post String Identifier",
- `og_title` varchar(255) DEFAULT NULL COMMENT "Post OG Title",
- `og_description` varchar(255) DEFAULT NULL COMMENT "Post OG Description",
- `og_img` binary(16) DEFAULT NULL COMMENT "Post OG Img",
- `og_type` varchar(255) DEFAULT NULL COMMENT "Post OG Type",
- `content_heading` mediumtext DEFAULT NULL COMMENT "Post Content Heading",
- `content` mediumtext COMMENT "Post Content",
`publish_time` DATETIME(3) NULL DEFAULT NULL COMMENT "Post Publish Time",
`is_active` smallint NOT NULL DEFAULT 1 COMMENT "Is Post Active",
`position` smallint NOT NULL DEFAULT 0 COMMENT "Position",
- `featured_img` varchar(255) DEFAULT NULL COMMENT "Thumbnail Image",
- `featured_img_alt` varchar(255) DEFAULT NULL COMMENT "Featured Image Alt",
`author_id` binary(16) DEFAULT NULL COMMENT "Author ID",
`page_layout` varchar(255) DEFAULT NULL COMMENT "Post Layout",
`layout_update_xml` text COMMENT "Post Layout Update Content",
@@ -64,65 +51,110 @@ public function update(Connection $connection): void
`secret` varchar(32) DEFAULT NULL COMMENT "Post Secret",
`views_count` int DEFAULT NULL COMMENT "Post Views Count",
`is_recent_posts_skip` smallint DEFAULT NULL COMMENT "Is Post Skipped From Recent Posts",
- `short_content` mediumtext COMMENT "Post Short Content",
`comments_count` int DEFAULT NULL COMMENT "Post Comment Counts",
`media_id` binary(16) DEFAULT NULL COMMENT "Media Id",
`post_media_version_id` binary(16) DEFAULT NULL,
`created_at` DATETIME(3) NOT NULL COMMENT "Post Comment Counts",
- `updated_at` DATETIME(3) NULL COMMENT "Post Comment Counts",
- PRIMARY KEY (`id`),
- KEY `MAGEFANBLOG_POST_IDENTIFIER` (`identifier`),
- KEY `MAGEFANBLOG_POST_AUTHOR_ID` (`author_id`),
- KEY `MAGEFANBLOG_POST_VIEWS_COUNT` (`views_count`),
- KEY `MAGEFANBLOG_POST_IS_RECENT_POSTS_SKIP` (`is_recent_posts_skip`),
- FULLTEXT KEY `FTI_A31A6CE1BAE9596AD2A53A8D37C22351` (`title`,`meta_keywords`,`meta_description`,`identifier`,`content`)
+ `updated_at` DATETIME(3) NULL COMMENT "Post Comment Counts",
+ PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Post Table";
'
);
$connection->executeStatement(
'
- INSERT INTO `magefanblog_post` (
- `id`, `title`, `meta_title`,
+ CREATE TABLE `magefanblog_post_translation` (
+ `magefanblog_post_id` binary(16) NOT NULL COMMENT "Post ID",
+ `language_id` BINARY(16) NOT NULL,
+ `title` varchar(255) NOT NULL COMMENT "Post Title",
+ `identifier` varchar(100) DEFAULT NULL COMMENT "Post String Identifier",
+ `meta_title` varchar(255) DEFAULT NULL COMMENT "Post Meta Title",
+ `meta_keywords` text COMMENT "Post Meta Keywords",
+ `meta_description` text COMMENT "Post Meta Description",
+ `og_title` varchar(255) DEFAULT NULL COMMENT "Post OG Title",
+ `og_description` varchar(255) DEFAULT NULL COMMENT "Post OG Description",
+ `og_img` binary(16) DEFAULT NULL COMMENT "Post OG Img",
+ `og_type` varchar(255) DEFAULT NULL COMMENT "Post OG Type",
+ `content_heading` mediumtext DEFAULT NULL COMMENT "Post Content Heading",
+ `content` mediumtext COMMENT "Post Content",
+ `featured_img` varchar(255) DEFAULT NULL COMMENT "Thumbnail Image",
+ `featured_img_alt` varchar(255) DEFAULT NULL COMMENT "Featured Image Alt",
+ `short_content` mediumtext COMMENT "Post Short Content",
+ `created_at` DATETIME(3) NOT NULL COMMENT "Post Comment Counts",
+ `updated_at` DATETIME(3) NULL COMMENT "Post Comment Counts",
+ PRIMARY KEY (`magefanblog_post_id`, `language_id`),
+ KEY `MAGEFANBLOG_POST_IDENTIFIER` (`identifier`),
+ FULLTEXT KEY `FTI_A31A6CE1BAE9596AD2A53A8D37C22351` (`title`,`meta_keywords`,`meta_description`,`content`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Post Table Translation";
+ '
+ );
+
+ $id = '265e0b57d2c54b49ba9e9e36ad4bc981';
+
+ $connection->executeStatement(
+ '
+ INSERT INTO `magefanblog_post` (
+ `id`, `created_at`, `updated_at`, `publish_time`,
+ `is_active`, `include_in_recent`,
+ `author_id`, `page_layout`, `layout_update_xml`,
+ `custom_theme`, `custom_layout`,
+ `custom_layout_update_xml`, `custom_theme_from`,
+ `custom_theme_to`, `media_gallery`, `secret`,
+ `views_count`, `is_recent_posts_skip`, `comments_count`
+ )
+ VALUES
+ (
+ :id, :createdAt, :updatedAt,
+ :publishTime, 1, 1,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, 0
+ );
+ ',
+ [
+ 'id' => Uuid::fromHexToBytes($id),
+ 'publishTime' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
+ 'updatedAt' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
+ 'createdAt' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)
+ ]
+ );
+
+ $languages = $connection->executeQuery('SELECT DISTINCT `language_id` FROM `sales_channel_language`')->fetchAll();
+
+ foreach ($languages as $language) {
+
+ $connection->executeStatement(
+ '
+ INSERT INTO `magefanblog_post_translation` (
+ `magefanblog_post_id`, `language_id`, `title`,`identifier`, `meta_title`,
`meta_keywords`, `meta_description`,
- `identifier`, `og_title`, `og_description`,
+ `og_title`, `og_description`,
`og_img`, `og_type`, `content_heading`,
- `content`, `created_at`, `updated_at`,
- `publish_time`, `is_active`, `include_in_recent`,
- `position`, `featured_img`, `featured_img_alt`,
- `author_id`, `page_layout`, `layout_update_xml`,
- `custom_theme`, `custom_layout`,
- `custom_layout_update_xml`, `custom_theme_from`,
- `custom_theme_to`, `media_gallery`,
- `secret`, `views_count`, `is_recent_posts_skip`,
- `short_content`, `comments_count`
+ `content`,`featured_img`, `featured_img_alt`,
+ `short_content`, `created_at`, `updated_at`
)
VALUES
(
- :id, :title,
- NULL, :metaKeywords, :metaDescription,
- :identifier , NULL,
+ :id, :languageId, :title, :identifier,
+ NULL, :metaKeywords, :metaDescription, NULL,
NULL, NULL, NULL, :contentHeading,
- :content,:createdAt, :updatedAt,
- :publishTime, 1, 1, 0, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, 0
+ :content, 0, NULL, NULL, :createdAt, :updatedAt
);
',
- [
- 'id' => Uuid::randomBytes(),
- 'title' => 'Magefan Blog Post Sample',
- 'identifier' => 'magefan-blog-post-sample',
- 'metaKeywords' => 'Magefan blog sample',
- 'metaDescription' => 'Magefan blog default post.',
- 'contentHeading' => 'Magefan Blog Post Sample',
- 'content' => 'Welcome to Blog extension by Magefan.\n This is your first post. Edit or delete it, then start blogging!\n
',
- 'publishTime' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
- 'updatedAt' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
- 'createdAt' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)
+ [
+ 'id' => Uuid::fromHexToBytes($id),
+ 'languageId' => $language['language_id'],
+ 'title' => 'Magefan Blog Post Sample',
+ 'identifier' => 'magefan-blog-post-sample',
+ 'metaKeywords' => 'Magefan blog sample',
+ 'metaDescription' => 'Magefan blog default post.',
+ 'contentHeading' => 'Magefan Blog Post Sample',
+ 'content' => 'Welcome to Blog extension by Magefan.
This is your first post. Edit or delete it, then start blogging!
',
+ 'updatedAt' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
+ 'createdAt' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)
]
- );
+ );
+ }
}
/**
diff --git a/src/Migration/Migration1663321276CreateBlogPostToCategoryLinkTable.php b/src/Migration/Migration1663321276CreateBlogPostToCategoryLinkTable.php
index 68d4eda..85c5094 100644
--- a/src/Migration/Migration1663321276CreateBlogPostToCategoryLinkTable.php
+++ b/src/Migration/Migration1663321276CreateBlogPostToCategoryLinkTable.php
@@ -35,12 +35,10 @@ public function update(Connection $connection): void
`id` binary(16) NOT NULL COMMENT "Depend ID",
`post_id` binary(16) NOT NULL COMMENT "Post ID",
`category_id` binary(16) NOT NULL COMMENT "Category ID",
+ `created_at` DATETIME(3) NOT NULL COMMENT "Depend Created At",
+ `updated_at` DATETIME(3) NULL COMMENT "Depend Updated At",
PRIMARY KEY (`id`, `post_id`,`category_id`),
- `created_at` DATETIME(3) NOT NULL,
- `updated_at` DATETIME(3) NULL,
- KEY `MAGEFAN_BLOG_POST_CATEGORY_CATEGORY_ID` (`category_id`),
- CONSTRAINT `MAGEFAN_BLOG_POST_CATEGORY_POST_ID_MAGEFAN_BLOG_POST_POST_ID` FOREIGN KEY (`post_id`) REFERENCES `magefanblog_post` (`id`) ON DELETE CASCADE,
- CONSTRAINT `MAGEFAN_BLOG_POST_CTGR_CTGR_ID_MAGEFAN_BLOG_CTGR_CTGR_ID` FOREIGN KEY (`category_id`) REFERENCES `magefanblog_category` (`id`) ON DELETE CASCADE
+ KEY `MAGEFAN_BLOG_POST_CATEGORY_CATEGORY_ID` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Post To Category Linkage Table"
'
);
diff --git a/src/Migration/Migration1663321745CreateBlogCategoryTable.php b/src/Migration/Migration1663321745CreateBlogCategoryTable.php
index 06197d4..f1cff2f 100644
--- a/src/Migration/Migration1663321745CreateBlogCategoryTable.php
+++ b/src/Migration/Migration1663321745CreateBlogCategoryTable.php
@@ -33,37 +33,50 @@ public function update(Connection $connection): void
'
CREATE TABLE `magefanblog_category` (
`id` binary(16) NOT NULL COMMENT "Category ID",
- `title` varchar(255) DEFAULT NULL COMMENT "Category Title",
- `meta_title` varchar(255) DEFAULT NULL COMMENT "Category Meta Title",
- `meta_keywords` text COMMENT "Category Meta Keywords",
- `meta_description` text COMMENT "Category Meta Description",
- `identifier` varchar(100) DEFAULT NULL COMMENT "Category String Identifier",
- `content_heading` mediumtext DEFAULT NULL COMMENT "Category Content Heading",
- `content` mediumtext COMMENT "Category Content",
- `path` varchar(255) DEFAULT NULL COMMENT "Category Path",
`position` smallint DEFAULT 10 COMMENT "Category Position",
- `posts_sort_by` varchar(15) DEFAULT "createdAt" NOT NULL COMMENT "Post Sort By",
+ `posts_sort_by` varchar(15) DEFAULT "createdAt" NOT NULL COMMENT "Category Sort By",
`include_in_menu` smallint DEFAULT NULL COMMENT "Category In Menu",
`is_active` smallint NOT NULL DEFAULT 1 COMMENT "Is Category Active",
`display_mode` smallint NOT NULL DEFAULT 0 COMMENT "Display Mode",
- `page_layout` varchar(255) DEFAULT NULL COMMENT "Post Layout",
- `layout_update_xml` text COMMENT "Post Layout Update Content",
- `custom_theme` varchar(100) DEFAULT NULL COMMENT "Post Custom Theme",
- `custom_layout` varchar(255) DEFAULT NULL COMMENT "Post Custom Template",
- `custom_layout_update_xml` text COMMENT "Post Custom Layout Update Content",
- `custom_theme_from` date DEFAULT NULL COMMENT "Post Custom Theme Active From Date",
- `custom_theme_to` date DEFAULT NULL COMMENT "Post Custom Theme Active To Date",
+ `page_layout` varchar(255) DEFAULT NULL COMMENT "Category Layout",
+ `layout_update_xml` text COMMENT "Category Layout Update Content",
+ `custom_theme` varchar(100) DEFAULT NULL COMMENT "Category Custom Theme",
+ `custom_layout` varchar(255) DEFAULT NULL COMMENT "Category Custom Template",
+ `custom_layout_update_xml` text COMMENT "Category Custom Layout Update Content",
+ `custom_theme_from` date DEFAULT NULL COMMENT "Category Custom Theme Active From Date",
+ `custom_theme_to` date DEFAULT NULL COMMENT "Category Custom Theme Active To Date",
`posts_per_page` int DEFAULT NULL COMMENT "Posts Per Page",
`posts_list_template` varchar(100) DEFAULT NULL COMMENT "Posts List Template",
`created_at` DATETIME(3) NOT NULL,
`updated_at` DATETIME(3) NULL,
PRIMARY KEY (`id`),
- KEY `MYM2MAGEFAN_BLOG_CATEGORY_IDENTIFIER` (`identifier`),
- KEY `MYM2MAGEFAN_BLOG_CATEGORY_INCLUDE_IN_MENU` (`include_in_menu`),
- FULLTEXT KEY `FTI_C41E1A43EC863C41B00FA78BD3B8E0EC` (`title`,`meta_keywords`,`meta_description`,`identifier`,`content`)
+ KEY `MYM2MAGEFAN_BLOG_CATEGORY_INCLUDE_IN_MENU` (`include_in_menu`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Category Table"
'
);
+
+ $connection->executeStatement(
+ '
+ CREATE TABLE `magefanblog_category_translation` (
+ `magefanblog_category_id` binary(16) NOT NULL COMMENT "Category ID",
+ `language_id` BINARY(16) NOT NULL COMMENT "Language Id",
+ `title` varchar(255) DEFAULT NULL COMMENT "Category Title",
+ `identifier` varchar(100) DEFAULT NULL COMMENT "Category String Identifier",
+ `meta_title` varchar(255) DEFAULT NULL COMMENT "Category Meta Title",
+ `meta_keywords` text COMMENT "Category Meta Keywords",
+ `meta_description` text COMMENT "Category Meta Description",
+ `content_heading` mediumtext DEFAULT NULL COMMENT "Category Content Heading",
+ `content` mediumtext COMMENT "Category Content",
+ `path` varchar(255) DEFAULT NULL COMMENT "Category Path",
+ `created_at` DATETIME(3) NOT NULL COMMENT "Category Translation Created At",
+ `updated_at` DATETIME(3) NULL COMMENT "Category Translation Updated At",
+ PRIMARY KEY (`magefanblog_category_id`, `language_id`),
+ KEY `MAGEFANBLOG_POST_IDENTIFIER` (`identifier`),
+ FULLTEXT KEY `FTI_A31A6CE1BAE9596AD2A53A8D37C22351` (`title`,`meta_keywords`,`meta_description`,`content`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Category Table Translation";
+ '
+ );
+
}
/**
diff --git a/src/Migration/Migration1663570403CreateBlogPostCommentTable.php b/src/Migration/Migration1663570403CreateBlogPostCommentTable.php
index 460d958..1132030 100644
--- a/src/Migration/Migration1663570403CreateBlogPostCommentTable.php
+++ b/src/Migration/Migration1663570403CreateBlogPostCommentTable.php
@@ -49,8 +49,7 @@ public function update(Connection $connection): void
KEY `MAGEFAN_BLOG_COMMENT_POST_ID` (`id`),
KEY `MAGEFAN_BLOG_COMMENT_CUSTOMER_ID` (`customer_id`),
KEY `MAGEFAN_BLOG_COMMENT_ADMIN_ID` (`admin_id`),
- KEY `MAGEFAN_BLOG_COMMENT_STATUS` (`status`),
- CONSTRAINT `MAGEFANBLOG_COMMENT_POST_ID_MAGEFAN_BLOG_POST_POST_ID` FOREIGN KEY (`post_id`) REFERENCES `magefanblog_post` (`id`) ON DELETE CASCADE
+ KEY `MAGEFAN_BLOG_COMMENT_STATUS` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT="magefanblog_comment"
'
);
diff --git a/src/Migration/Migration1663655011CreateBlogTagTable.php b/src/Migration/Migration1663655011CreateBlogTagTable.php
index ebf79b7..1949d4d 100644
--- a/src/Migration/Migration1663655011CreateBlogTagTable.php
+++ b/src/Migration/Migration1663655011CreateBlogTagTable.php
@@ -33,15 +33,8 @@ public function update(Connection $connection): void
'
CREATE TABLE `magefanblog_tag` (
`id` binary(16) NOT NULL COMMENT "Tag ID",
- `title` varchar(255) NOT NULL COMMENT "Tag Title",
- `meta_robots` varchar(255) DEFAULT NULL COMMENT "Tag Default Robots",
- `meta_description` varchar(255) DEFAULT NULL COMMENT "Tag Meta Description",
- `meta_keywords` varchar(255) DEFAULT NULL COMMENT "Tag Meta Keywords",
- `meta_title` varchar(255) DEFAULT NULL COMMENT "Tag Meta Title",
- `identifier` varchar(100) DEFAULT NULL COMMENT "Tag String Identifier",
`page_layout` varchar(255) DEFAULT NULL COMMENT "Tag Layout",
`is_active` smallint NOT NULL DEFAULT 1 COMMENT "Is Tag Active",
- `content` mediumtext COMMENT "Tag Content",
`layout_update_xml` text COMMENT "Tag Layout Update Content",
`custom_theme` varchar(100) DEFAULT NULL COMMENT "Tag Custom Theme",
`custom_layout` varchar(255) DEFAULT NULL COMMENT "Tag Custom Template",
@@ -50,14 +43,33 @@ public function update(Connection $connection): void
`custom_theme_to` date DEFAULT NULL COMMENT "Tag Custom Theme Active To Date",
`posts_per_page` int DEFAULT NULL COMMENT "Posts Per Page",
`posts_list_template` varchar(100) DEFAULT NULL COMMENT "Posts List Template",
- `created_at` DATETIME(3) NOT NULL,
- `updated_at` DATETIME(3) NULL,
+ `created_at` DATETIME(3) NOT NULL COMMENT "Tag Created At",
+ `updated_at` DATETIME(3) NULL COMMENT "Tag Update At",
PRIMARY KEY (`id`),
- KEY `MAGEFANBLOG_TAG_IDENTIFIER` (`identifier`),
KEY `MAGEFANBLOG_TAG_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Tag Table"
'
);
+
+ $connection->executeStatement(
+ '
+ CREATE TABLE `magefanblog_tag_translation` (
+ `magefanblog_tag_id` binary(16) NOT NULL COMMENT "Tag ID",
+ `language_id` BINARY(16) NOT NULL,
+ `title` varchar(255) NOT NULL COMMENT "Tag Title",
+ `identifier` varchar(100) DEFAULT NULL COMMENT "Tag String Identifier",
+ `meta_robots` varchar(255) DEFAULT NULL COMMENT "Tag Default Robots",
+ `meta_description` varchar(255) DEFAULT NULL COMMENT "Tag Meta Description",
+ `meta_keywords` varchar(255) DEFAULT NULL COMMENT "Tag Meta Keywords",
+ `meta_title` varchar(255) DEFAULT NULL COMMENT "Tag Meta Title",
+ `content` mediumtext COMMENT "Tag Content",
+ `created_at` DATETIME(3) NOT NULL COMMENT "Tag Translation Created At",
+ `updated_at` DATETIME(3) NULL COMMENT "Tag Translation Update At",
+ PRIMARY KEY (`magefanblog_tag_id`, `language_id`),
+ KEY `MAGEFANBLOG_POST_IDENTIFIER` (`identifier`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Tag Table Translation";
+ '
+ );
}
/**
diff --git a/src/Migration/Migration1663658563CreateBlogPostTagTable.php b/src/Migration/Migration1663658563CreateBlogPostTagTable.php
index cba058c..4f17011 100644
--- a/src/Migration/Migration1663658563CreateBlogPostTagTable.php
+++ b/src/Migration/Migration1663658563CreateBlogPostTagTable.php
@@ -35,12 +35,10 @@ public function update(Connection $connection): void
`id` binary(16) NOT NULL COMMENT "Depend ID",
`post_id` binary(16) NOT NULL COMMENT "Post ID",
`tag_id` binary(16) NOT NULL COMMENT "Tag ID",
- `created_at` DATETIME(3) NOT NULL,
- `updated_at` DATETIME(3) NULL,
+ `created_at` DATETIME(3) NOT NULL COMMENT "Depend Created At",
+ `updated_at` DATETIME(3) NULL COMMENT "Depend Updated At",
PRIMARY KEY (`id`),
- KEY `MAGEFANBLOG_POST_TAG_TAG_ID` (`tag_id`),
- CONSTRAINT `MAGEFANBLOG_POST_TAG_POST_ID_MAGEFAN_BLOG_POST_POST_ID` FOREIGN KEY (`post_id`) REFERENCES `magefanblog_post` (`id`) ON DELETE CASCADE,
- CONSTRAINT `MAGEFANBLOG_POST_TAG_TAG_ID_MAGEFAN_BLOG_TAG_TAG_ID` FOREIGN KEY (`tag_id`) REFERENCES `magefanblog_tag` (`id`) ON DELETE CASCADE
+ KEY `MAGEFANBLOG_POST_TAG_TAG_ID` (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT="Magefan Blog Post To Category Linkage Table"
'
);
diff --git a/src/Migration/Migration1663741704CreateBlogAuthorTable.php b/src/Migration/Migration1663741704CreateBlogAuthorTable.php
index 9b6afc6..9a82b2e 100644
--- a/src/Migration/Migration1663741704CreateBlogAuthorTable.php
+++ b/src/Migration/Migration1663741704CreateBlogAuthorTable.php
@@ -33,12 +33,8 @@ public function update(Connection $connection): void
'
CREATE TABLE `magefanblog_author` (
`id` binary(16) NOT NULL COMMENT "Author ID",
- `is_active` smallint NOT NULL DEFAULT 1 COMMENT "Is Author Active",
`firstname` varchar(255) DEFAULT NULL COMMENT "Author FirstName",
`lastname` varchar(255) DEFAULT NULL COMMENT "Author LastName",
- `admin_user_id` binary(16) NOT NULL COMMENT "Admin user ID",
- `email` varchar(255) DEFAULT NULL COMMENT "Author Email",
- `role` varchar(255) DEFAULT NULL COMMENT "Author role (developer)",
`facebook_page_url` varchar(255) DEFAULT NULL COMMENT "Author in Facebook",
`twitter_page_url` varchar(255) DEFAULT NULL COMMENT "Author in Twitter",
`instagram_page_url` varchar(255) DEFAULT NULL COMMENT "Author in Instagram",
@@ -52,6 +48,10 @@ public function update(Connection $connection): void
`content` mediumtext COMMENT "Author Content",
`short_content` mediumtext COMMENT "Author Short Content",
`featured_img` varchar(255) DEFAULT NULL COMMENT "Author Image",
+ `is_active` smallint NOT NULL DEFAULT 1 COMMENT "Is Author Active",
+ `admin_user_id` binary(16) NOT NULL COMMENT "Admin user ID",
+ `email` varchar(255) DEFAULT NULL COMMENT "Author Email",
+ `role` varchar(255) DEFAULT NULL COMMENT "Author role (developer)",
`page_layout` varchar(255) DEFAULT NULL COMMENT "Author Layout",
`layout_update_xml` text COMMENT "Author Layout Update Content",
`custom_theme` varchar(100) DEFAULT NULL COMMENT "Author Custom Thema",
diff --git a/src/Migration/Migration1677140148StaticSeoUrl.php b/src/Migration/Migration1677140148StaticSeoUrl.php
new file mode 100644
index 0000000..466711a
--- /dev/null
+++ b/src/Migration/Migration1677140148StaticSeoUrl.php
@@ -0,0 +1,95 @@
+getLanguages($connection) as $language) {
+
+ $translationUrl[] =
+ [
+ 'id' => Uuid::randomBytes(),
+ 'sales_channel_id' => $this->getSalesChannelId($connection),
+ 'foreign_key' => Uuid::fromHexToBytes($id),
+ 'route_name' => 'frontend.blog.post',
+ 'path_info' => '/blog/post/265e0b57d2c54b49ba9e9e36ad4bc981',
+ 'is_canonical' => 1,
+ 'is_modified' => 0,
+ 'is_deleted' => 0,
+ 'seo_path_info' => 'blog/post/magefan-blog-post-sample'
+ ];
+ }
+ $this->importTranslation('seo_url', new Translations(
+ $translationUrl[1] ?? $translationUrl[0],
+ $translationUrl[0]
+ ),
+ $connection);
+ }
+
+ /**
+ * @param Connection $connection
+ * @return void
+ */
+ public function updateDestructive(Connection $connection): void
+ {
+ }
+
+ /**
+ * @param $connection
+ * @return mixed
+ */
+ private function getLanguages($connection)
+ {
+ return $connection->executeQuery('SELECT DISTINCT `language_id` FROM `sales_channel_language`')->fetchAll();
+ }
+
+ /**
+ * @param Connection $connection
+ * @return string|null
+ * @throws Exception
+ */
+ private function getSalesChannelId(Connection $connection): ?string
+ {
+ $sql = <<fetchOne($sql, [
+ 'typeId' => Uuid::fromHexToBytes(Defaults::SALES_CHANNEL_TYPE_STOREFRONT)
+ ]);
+
+ if (!$salesChannelId) {
+ return null;
+ }
+
+ return $salesChannelId;
+ }
+}
diff --git a/src/Migration/Migration1677140955AddBlogSeoUrlTemplate.php b/src/Migration/Migration1677140955AddBlogSeoUrlTemplate.php
new file mode 100644
index 0000000..9d9253e
--- /dev/null
+++ b/src/Migration/Migration1677140955AddBlogSeoUrlTemplate.php
@@ -0,0 +1,57 @@
+ 'magefanblog_post',
+ 'Category' => 'magefanblog_category',
+ 'Tag' => 'magefanblog_tag'
+ ];
+
+ /**
+ * @return int
+ */
+ public function getCreationTimestamp(): int
+ {
+ return 1677140955;
+ }
+
+ /**
+ * @param Connection $connection
+ * @return void
+ * @throws Exception
+ */
+ public function update(Connection $connection): void
+ {
+ foreach (self::TEMPLATES_DETAIL as $name => $entityDetail) {
+ $className = '\Magefan\Blog\Storefront\Framework\Seo\SeoUrlRoute\Blog' . $name . 'PageSeoUrlRoute';
+ if ($entityDetail) {
+ $connection->insert('seo_url_template', [
+ 'id' => Uuid::randomBytes(),
+ 'sales_channel_id' => null,
+ 'route_name' => $className::ROUTE_NAME,
+ 'entity_name' => $entityDetail,
+ 'template' => $className::DEFAULT_TEMPLATE,
+ 'created_at' => (new \DateTimeImmutable())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
+ ]);
+ }
+ }
+ }
+
+ /**
+ * @param Connection $connection
+ * @return void
+ */
+ public function updateDestructive(Connection $connection): void
+ {
+ // implement update destructive
+ }
+}
diff --git a/src/Resources/app/administration/src/module/blog-category/component/blog-category-clone-modal/index.js b/src/Resources/app/administration/src/module/blog-category/component/blog-category-clone-modal/index.js
index bfa22db..c778913 100644
--- a/src/Resources/app/administration/src/module/blog-category/component/blog-category-clone-modal/index.js
+++ b/src/Resources/app/administration/src/module/blog-category/component/blog-category-clone-modal/index.js
@@ -71,7 +71,7 @@ Component.register('blog-category-clone-modal', {
},
};
- await this.repository.save(this.product);
+ await this.repository.save(this.category, Context.api);
const clone = await this.repository.clone(this.category.id, Shopware.Context.api, behavior);
return {id: clone.id, productNumber: number.number};
diff --git a/src/Resources/app/administration/src/module/blog-category/component/blog-category-seo/blog-category-seo.html.twig b/src/Resources/app/administration/src/module/blog-category/component/blog-category-seo/blog-category-seo.html.twig
index e52a528..475202c 100644
--- a/src/Resources/app/administration/src/module/blog-category/component/blog-category-seo/blog-category-seo.html.twig
+++ b/src/Resources/app/administration/src/module/blog-category/component/blog-category-seo/blog-category-seo.html.twig
@@ -17,7 +17,7 @@
type="text"
:label="$tc('blog-category.detail.labelIdentifier')"
:placeholder="$tc('blog-category.detail.placeholderUrlKey')"
- :disabled="!allowEdit"
+ :disabled="true"
/>
{% endblock %}
diff --git a/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/blog-category-detail.html.twig b/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/blog-category-detail.html.twig
index dc028a6..d6bf73d 100644
--- a/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/blog-category-detail.html.twig
+++ b/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/blog-category-detail.html.twig
@@ -43,6 +43,21 @@
{% endblock %}
+ {% block blog_category_detail_language_switch %}
+
+
+
+ {% endblock %}
+
+ {% block blog_category_detail_language_info %}
+
+ {% endblock %}
+
{% block blog_category_detail_content %}
diff --git a/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/index.js b/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/index.js
index 746ac4e..9a8ffe3 100644
--- a/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/index.js
+++ b/src/Resources/app/administration/src/module/blog-category/page/blog-category-detail/index.js
@@ -5,9 +5,8 @@
import template from './blog-category-detail.html.twig';
import slug from "slug";
-import path from "path";
-const {Component, Mixin, Data: {Criteria}} = Shopware;
+const {Component, Context, Mixin, Data: {Criteria}} = Shopware;
const {mapPropertyErrors} = Shopware.Component.getComponentHelper();
@@ -40,6 +39,8 @@ Component.register('blog-category-detail', {
rootCategoryBlog: {},
isLoading: false,
isSaveSuccessful: false,
+ isChangedLanguage: Shopware.Context.api.languageId,
+ isNew: true,
};
},
@@ -107,6 +108,12 @@ Component.register('blog-category-detail', {
},
watch: {
+ 'category.title': function (value) {
+ if (value) {
+ let postIdentifier = slug(this.category.title, '-');
+ this.buildIdentifier(postIdentifier, 1)
+ }
+ },
id() {
this.createdComponent();
},
@@ -123,10 +130,19 @@ Component.register('blog-category-detail', {
return;
}
+ if (Shopware.Context.api.languageId !== Shopware.Context.api.systemLanguageId) {
+ Shopware.State.commit('context/setApiLanguageId', Shopware.Context.api.languageId)
+ }
+
+ if (!Shopware.State.getters['context/isSystemDefaultLanguage']) {
+ Shopware.State.commit('context/resetLanguageToDefault');
+ }
+
this.category = this.categoryRepository.create();
},
loadEntityData() {
+ this.isNew = false;
this.categoryRepository.get(this.id).then((category) => {
this.isLoading = false;
this.category = category;
@@ -167,18 +183,18 @@ Component.register('blog-category-detail', {
category.parentId = rootCategory[0].id;
category.name = this.category.title
category.linkType = 'external';
- category.externalLink = rootCategory[0].externalLink + '/category/' + this.category.identifier;
+ category.externalLink = rootCategory[0].externalLink + '/category/' + this.category.id;
category.level = 3;
category.active = Boolean(this.category.isActive && this.category.includeInMenu);
- this.categoryMenuRepository.save(category);
+ this.categoryMenuRepository.save(category, Context.api);
} else if(rootCategory[0].id && category) {
this.categoryMenuRepository.get(this.category.id).then((category) => {
category.id = this.category.id;
category.name = this.category.title
- category.externalLink = rootCategory[0].externalLink + '/category/' + this.category.identifier;
+ category.externalLink = rootCategory[0].externalLink + '/category/' + this.category.id;
category.level = 3;
category.active = Boolean(this.category.isActive && this.category.includeInMenu);
- this.categoryMenuRepository.save(category);
+ this.categoryMenuRepository.save(category, Context.api);
});
}
})
@@ -196,18 +212,7 @@ Component.register('blog-category-detail', {
onSave() {
this.isLoading = true;
-
- let identifier = this.category.identifier
- if (this.category.title) {
- if (identifier !== undefined && !this.isUrlValid(identifier)) {
- identifier = slug(identifier, '-');
- } else {
- identifier = slug(this.category.title, '-');
- }
- }
-
- this.category.identifier = identifier;
- this.categoryRepository.save(this.category).then(() => {
+ this.categoryRepository.save(this.category, Context.api).then(() => {
this.updateCategoryMenu()
this.isLoading = false;
this.isSaveSuccessful = true;
@@ -227,16 +232,30 @@ Component.register('blog-category-detail', {
});
},
+ onChangeLanguage(languageId) {
+
+ Shopware.State.commit('context/setApiLanguageId', languageId);
+
+ this.isChangedLanguage = languageId;
+ this.loadEntityData();
+ },
+
onCancel() {
this.$router.push({name: 'blog.category.list'});
},
- isUrlValid(str) {
- return /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/.test(str);
+ buildIdentifier(finalIdentifier, number){
+ let numberItem = (number > 1 ? '-' + number : '');
+ const criteria = new Criteria();
+ criteria.addFilter(Criteria.equals('identifier', finalIdentifier + numberItem));
+ return this.categoryRepository.search(criteria, Shopware.Context.api).then((result) => {
+ if(result.length === 0){
+ return this.category.identifier = slug(finalIdentifier + numberItem, '-');
+ }else {
+ number++;
+ this.buildIdentifier(finalIdentifier, number);
+ }
+ });
},
-
- prepareIdentifier(str) {
- return str.replace(/ +/g, '-').toLowerCase();
- }
}
});
diff --git a/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/blog-category-list.html.twig b/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/blog-category-list.html.twig
index c5cc385..69d3252 100644
--- a/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/blog-category-list.html.twig
+++ b/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/blog-category-list.html.twig
@@ -42,6 +42,12 @@
{% endblock %}
+ {% block blog_category_list_language_switch %}
+
+
+
+ {% endblock %}
+
{% block blog_category_list_content %}
diff --git a/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/index.js b/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/index.js
index 3f662bd..092c55b 100644
--- a/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/index.js
+++ b/src/Resources/app/administration/src/module/blog-category/page/blog-category-list/index.js
@@ -4,7 +4,7 @@
*/
const {Component, Mixin} = Shopware;
-const {Criteria} = Shopware.Data;
+const {Context, Data: { Criteria } } = Shopware;
import template from './blog-category-list.html.twig';
@@ -30,8 +30,6 @@ Component.register('blog-category-list', {
sortDirection: 'DESC',
naturalSorting: false,
total: 0,
- limit: 10,
- page: 1,
showDeleteModal: false,
searchConfigEntity: 'magefanblog_category',
};
@@ -128,6 +126,13 @@ Component.register('blog-category-list', {
})
},
+ onChangeLanguage(languageId) {
+
+ Shopware.State.commit('context/setApiLanguageId', languageId);
+
+ this.getList();
+ },
+
updateTotal({total}) {
this.total = total;
},
diff --git a/src/Resources/app/administration/src/module/blog-category/snippet/en-GB.json b/src/Resources/app/administration/src/module/blog-category/snippet/en-GB.json
index 89515f8..ac822cb 100644
--- a/src/Resources/app/administration/src/module/blog-category/snippet/en-GB.json
+++ b/src/Resources/app/administration/src/module/blog-category/snippet/en-GB.json
@@ -67,6 +67,12 @@
}
},
+ "sw-seo-url-template-card": {
+ "routeNames": {
+ "frontend-blog-category": "Magefan Blog Category"
+ }
+ },
+
"sw-privileges": {
"permissions": {
"blog_category": {
diff --git a/src/Resources/app/administration/src/module/blog-comment/page/blog-comment-detail/index.js b/src/Resources/app/administration/src/module/blog-comment/page/blog-comment-detail/index.js
index da2b269..a7f75cf 100644
--- a/src/Resources/app/administration/src/module/blog-comment/page/blog-comment-detail/index.js
+++ b/src/Resources/app/administration/src/module/blog-comment/page/blog-comment-detail/index.js
@@ -6,7 +6,7 @@
import template from './blog-comment-detail.html.twig';
import errorConfig from './error-config.json';
-const { Component, Mixin, Data: { Criteria } } = Shopware;
+const { Component, Context, Mixin, Data: { Criteria } } = Shopware;
const { mapPageErrors, mapPropertyErrors } = Shopware.Component.getComponentHelper();
@@ -129,7 +129,7 @@ Component.register('blog-comment-detail', {
onSave() {
this.isLoading = true;
- return this.commentRepository.save(this.comment).then(() => {
+ return this.commentRepository.save(this.comment, Context.api).then(() => {
this.isLoading = false;
this.isSaveSuccessful = true;
}).catch((exception) => {
diff --git a/src/Resources/app/administration/src/module/blog-post/component/blog-post-clone-modal/index.js b/src/Resources/app/administration/src/module/blog-post/component/blog-post-clone-modal/index.js
index 6374d63..f80e979 100644
--- a/src/Resources/app/administration/src/module/blog-post/component/blog-post-clone-modal/index.js
+++ b/src/Resources/app/administration/src/module/blog-post/component/blog-post-clone-modal/index.js
@@ -63,7 +63,7 @@ Component.register('blog-post-clone-modal', {
},
};
- await this.repository.save(this.post);
+ await this.repository.save(this.post, Context.api);
const clone = await this.repository.clone(this.post.id, Shopware.Context.api, behavior);
return { id: clone.id };
diff --git a/src/Resources/app/administration/src/module/blog-post/component/blog-post-detail-base/index.js b/src/Resources/app/administration/src/module/blog-post/component/blog-post-detail-base/index.js
index 17333e4..63101ea 100644
--- a/src/Resources/app/administration/src/module/blog-post/component/blog-post-detail-base/index.js
+++ b/src/Resources/app/administration/src/module/blog-post/component/blog-post-detail-base/index.js
@@ -26,6 +26,10 @@ Component.register('blog-post-detail-base', {
return {};
},
},
+ isChangedLanguage: {
+ type: String,
+ default: false,
+ },
isLoading: {
type: Boolean,
default: false,
@@ -45,6 +49,12 @@ Component.register('blog-post-detail-base', {
};
},
+ watch: {
+ isChangedLanguage () {
+ this.initValues();
+ }
+ },
+
computed: {
postRepository() {
return this.repositoryFactory.create('magefanblog_post');
@@ -72,7 +82,7 @@ Component.register('blog-post-detail-base', {
getAllCategories() {
const criteria = new Criteria();
- this.categoryRepository.search(criteria).then((categories) => {
+ this.categoryRepository.search(criteria, Shopware.Context.api).then((categories) => {
const preparedCategories = [];
for (let category of categories) {
preparedCategories.push({value: category.id, label: category.title})
diff --git a/src/Resources/app/administration/src/module/blog-post/component/blog-post-display-setting/index.js b/src/Resources/app/administration/src/module/blog-post/component/blog-post-display-setting/index.js
index cd31d30..98ae2ce 100644
--- a/src/Resources/app/administration/src/module/blog-post/component/blog-post-display-setting/index.js
+++ b/src/Resources/app/administration/src/module/blog-post/component/blog-post-display-setting/index.js
@@ -26,6 +26,10 @@ Component.register('blog-post-display-setting', {
return {};
},
},
+ isChangedLanguage: {
+ type: String,
+ default: false,
+ },
isLoading: {
type: Boolean,
default: false,
@@ -37,6 +41,12 @@ Component.register('blog-post-display-setting', {
},
},
+ watch: {
+ isChangedLanguage () {
+ this.initValues();
+ }
+ },
+
created() {
this.initValues();
this.checkAuthorExist();
@@ -83,7 +93,7 @@ Component.register('blog-post-display-setting', {
getAllTags() {
const criteria = new Criteria();
- this.tagRepository.search(criteria).then((tags) => {
+ this.tagRepository.search(criteria, Shopware.Context.api).then((tags) => {
const preparedTags = [];
for (let tag of tags) {
preparedTags.push({value: tag.id, label: tag.title})
@@ -119,11 +129,11 @@ Component.register('blog-post-display-setting', {
criteria.addFilter(Criteria.equals('adminUserId', this.getAdminUser.id));
this.authorRepository.search(criteria, Shopware.Context.api).then((author) => {
if (author.total === 0 && !this.post.authorId){
- this.authorItem = this.authorRepository.create();
+ this.authorItem = this.authorRepository.create(Shopware.Context.api);
this.authorItem.firstname = this.getAdminUser.firstName;
this.authorItem.lastname = this.getAdminUser.lastName;
this.authorItem.adminUserId = this.getAdminUser.id;
- this.authorRepository.save(this.authorItem).then((result) => {
+ this.authorRepository.save(this.authorItem, Context.api).then((result) => {
const author = JSON.parse(result.config.data);
if (author.id){
this.post.authorId = author.id;
diff --git a/src/Resources/app/administration/src/module/blog-post/component/blog-post-media-form/index.js b/src/Resources/app/administration/src/module/blog-post/component/blog-post-media-form/index.js
index 3a1bbc7..b736a79 100644
--- a/src/Resources/app/administration/src/module/blog-post/component/blog-post-media-form/index.js
+++ b/src/Resources/app/administration/src/module/blog-post/component/blog-post-media-form/index.js
@@ -123,7 +123,7 @@ Component.register('blog-post-media-form', {
loadEntityData() {
this.isLoading = true;
- this.postRepository.get(this.postId).then((post) => {
+ this.postRepository.get(this.postId, Shopware.Context.api).then((post) => {
this.isLoading = false;
this.post = post;
});
@@ -156,7 +156,7 @@ Component.register('blog-post-media-form', {
this.isLoading = true;
- this.postRepository.save(this.post).then(() => {
+ this.postRepository.save(this.post, Context.api).then(() => {
this.isLoading = false;
this.isSaveSuccessful = true;
if (this.postId === null) {
diff --git a/src/Resources/app/administration/src/module/blog-post/component/blog-post-seo/blog-post-seo.html.twig b/src/Resources/app/administration/src/module/blog-post/component/blog-post-seo/blog-post-seo.html.twig
index 8ae24f2..2d9628b 100644
--- a/src/Resources/app/administration/src/module/blog-post/component/blog-post-seo/blog-post-seo.html.twig
+++ b/src/Resources/app/administration/src/module/blog-post/component/blog-post-seo/blog-post-seo.html.twig
@@ -16,8 +16,8 @@
v-model="post.identifier"
type="text"
:label="$tc('blog-post.detail.labelIdentifier')"
- :disabled="!acl.can('blog_post.editor')"
:placeholder="$tc('blog-post.detail.placeholderUrlKey')"
+ :disabled="true"
/>
{% endblock %}
diff --git a/src/Resources/app/administration/src/module/blog-post/page/blog-post-create/index.js b/src/Resources/app/administration/src/module/blog-post/page/blog-post-create/index.js
index fdf2032..ab19d2a 100644
--- a/src/Resources/app/administration/src/module/blog-post/page/blog-post-create/index.js
+++ b/src/Resources/app/administration/src/module/blog-post/page/blog-post-create/index.js
@@ -19,7 +19,7 @@ Component.extend('blog-post-create', 'blog-post-detail', {
methods: {
createdComponent() {
- this.post = this.postRepository.create();
+ this.post = this.postRepository.create(Shopware.Context.api);
this.newId = this.post.id;
this.isLoading = false;
diff --git a/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/blog-post-detail.html.twig b/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/blog-post-detail.html.twig
index e18ab94..2c942f1 100644
--- a/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/blog-post-detail.html.twig
+++ b/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/blog-post-detail.html.twig
@@ -45,6 +45,22 @@
{% endblock %}
+ {% block blog_post_detail_language_switch %}
+
+
+
+
+ {% endblock %}
+
+ {% block blog_post_detail_language_info %}
+
+ {% endblock %}
+
{% block blog_post_detail_content %}
@@ -58,6 +74,7 @@
@@ -75,6 +92,7 @@
diff --git a/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/index.js b/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/index.js
index 8941803..d9da769 100644
--- a/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/index.js
+++ b/src/Resources/app/administration/src/module/blog-post/page/blog-post-detail/index.js
@@ -6,8 +6,7 @@
import template from './blog-post-detail.html.twig';
import slug from "slug";
-const {Component, Mixin, Context} = Shopware;
-const {Criteria} = Shopware.Data;
+const { Component, Mixin,Context, Data: { Criteria } } = Shopware;
Component.register('blog-post-detail', {
template,
@@ -34,7 +33,7 @@ Component.register('blog-post-detail', {
},
props: {
- postId: {
+ id: {
type: String,
default: null,
},
@@ -52,6 +51,7 @@ Component.register('blog-post-detail', {
categoryItem: {},
existTag: false,
existCategory: false,
+ isChangedLanguage: Shopware.Context.api.languageId,
};
},
@@ -63,7 +63,7 @@ Component.register('blog-post-detail', {
computed: {
identifier() {
- return this.placeholder(this.post, 'position');
+ return this.placeholder(this.post, 'title');
},
optionRepository() {
@@ -120,7 +120,13 @@ Component.register('blog-post-detail', {
},
watch: {
- postId() {
+ 'post.title': function (value) {
+ if (value) {
+ let postIdentifier = slug(this.post.title, '-');
+ this.buildIdentifier(postIdentifier, 1)
+ }
+ },
+ id() {
this.loadEntityData();
},
},
@@ -131,6 +137,14 @@ Component.register('blog-post-detail', {
methods: {
createdComponent() {
+ if (Shopware.Context.api.languageId !== Shopware.Context.api.systemLanguageId) {
+ Shopware.State.commit('context/setApiLanguageId', Shopware.Context.api.languageId)
+ }
+
+ if (!Shopware.State.getters['context/isSystemDefaultLanguage']) {
+ Shopware.State.commit('context/resetLanguageToDefault');
+ }
+
this.loadEntityData();
},
@@ -145,7 +159,7 @@ Component.register('blog-post-detail', {
loadEntityData() {
this.isLoading = true;
- this.postRepository.get(this.$attrs.id, Shopware.Context.api, this.defaultCriteria)
+ this.postRepository.get(this.id, Shopware.Context.api, this.defaultCriteria)
.then((currentPost) => {
this.post = currentPost;
this.isLoading = false;
@@ -154,6 +168,14 @@ Component.register('blog-post-detail', {
});
},
+ onChangeLanguage(languageId) {
+
+ Shopware.State.commit('context/setApiLanguageId', languageId);
+
+ this.isChangedLanguage = languageId;
+ this.loadEntityData();
+ },
+
saveFinish() {
this.isSaveSuccessful = false;
},
@@ -162,19 +184,9 @@ Component.register('blog-post-detail', {
this.isLoading = true;
return new Promise((resolve) => {
- let identifier = this.post.identifier
- if (this.post.title) {
- if (identifier !== undefined && !this.isUrlValid(identifier)) {
- identifier = slug(identifier, '-');
- } else {
- identifier = slug(this.post.title, '-');
- }
- this.post.identifier = identifier;
- }
-
this.updateCategories();
this.updateTags();
- this.postRepository.save(this.post).then(() => {
+ this.postRepository.save(this.post, Context.api).then(() => {
this.isLoading = false;
this.isSaveSuccessful = true;
if (this.post.id) {
@@ -202,10 +214,10 @@ Component.register('blog-post-detail', {
for (const category of this.categories) {
this.checkCategoryExists(category).then((isCategoryNotExist) => {
if (this.existCategory) {
- this.categoryItem = this.postCategoryRepository.create();
+ this.categoryItem = this.postCategoryRepository.create(Shopware.Context.api);
this.categoryItem.categoryId = category;
this.categoryItem.postId = this.post.id;
- this.postCategoryRepository.save(this.categoryItem).then(() => {
+ this.postCategoryRepository.save(this.categoryItem, Context.api).then(() => {
}).catch((response) => {
// resolve(response);
@@ -215,7 +227,7 @@ Component.register('blog-post-detail', {
}
const criteria = new Criteria();
criteria.addFilter(Criteria.equals('postId', this.post.id));
- this.postCategoryRepository.search(criteria).then((relations) => {
+ this.postCategoryRepository.search(criteria, Shopware.Context.api).then((relations) => {
if (relations) {
for (const relation of relations) {
@@ -267,10 +279,6 @@ Component.register('blog-post-detail', {
this.$router.push({name: 'blog.post.index'});
},
- isUrlValid(str) {
- return /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/.test(str);
- },
-
checkCategoryExists(category) {
const criteria = new Criteria();
criteria.addFilter(Criteria.equals('categoryId', category));
@@ -290,5 +298,19 @@ Component.register('blog-post-detail', {
return this.existTag = (response.total === 0);
});
},
+
+ buildIdentifier(finalIdentifier, number){
+ let numberItem = (number > 1 ? '-' + number : '');
+ const criteria = new Criteria();
+ criteria.addFilter(Criteria.equals('identifier', finalIdentifier + numberItem));
+ return this.postRepository.search(criteria, Shopware.Context.api).then((result) => {
+ if(result.length === 0){
+ return this.post.identifier = slug(finalIdentifier + numberItem, '-');
+ }else {
+ number++;
+ this.buildIdentifier(finalIdentifier, number);
+ }
+ });
+ },
},
});
diff --git a/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/blog-post-list.html.twig b/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/blog-post-list.html.twig
index 0c7505b..8bf5b26 100644
--- a/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/blog-post-list.html.twig
+++ b/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/blog-post-list.html.twig
@@ -42,6 +42,12 @@
{% endblock %}
+ {% block blog_post_list_language_switch %}
+
+
+
+ {% endblock %}
+
{% block blog_post_list_content %}
@@ -63,7 +69,7 @@
{{ $tc('blog-post.list.editOption') }}
diff --git a/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/index.js b/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/index.js
index f9f1e9d..9cfd249 100644
--- a/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/index.js
+++ b/src/Resources/app/administration/src/module/blog-post/page/blog-post-list/index.js
@@ -30,8 +30,6 @@ Component.register('blog-post-list', {
sortDirection: 'DESC',
naturalSorting: false,
total: 0,
- limit: 10,
- page: 1,
showDeleteModal: false,
searchConfigEntity: 'magefanblog_post',
};
@@ -164,13 +162,20 @@ Component.register('blog-post-list', {
criteria.addAssociation('postAuthor');
this.repository = this.repositoryFactory.create('magefanblog_post');
- this.repository.search(criteria).then((result) => {
+ this.repository.search(criteria, Shopware.Context.api).then((result) => {
this.posts = result;
this.total = result.total;
this.isLoading = false;
})
},
+ onChangeLanguage(languageId) {
+
+ Shopware.State.commit('context/setApiLanguageId', languageId);
+
+ this.getList();
+ },
+
updateTotal({total}) {
this.total = total;
},
diff --git a/src/Resources/app/administration/src/module/blog-post/snippet/en-GB.json b/src/Resources/app/administration/src/module/blog-post/snippet/en-GB.json
index 392fc6f..b82eda4 100644
--- a/src/Resources/app/administration/src/module/blog-post/snippet/en-GB.json
+++ b/src/Resources/app/administration/src/module/blog-post/snippet/en-GB.json
@@ -102,6 +102,12 @@
}
},
+ "sw-seo-url-template-card": {
+ "routeNames": {
+ "frontend-blog-post": "Magefan Blog Post"
+ }
+ },
+
"sw-privileges": {
"permissions": {
"blog_post": {
diff --git a/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-clone-modal/index.js b/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-clone-modal/index.js
index 5c331a6..e6f1bd3 100644
--- a/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-clone-modal/index.js
+++ b/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-clone-modal/index.js
@@ -63,7 +63,7 @@ Component.register('blog-tag-clone-modal', {
},
};
- await this.repository.save(this.tag);
+ await this.repository.save(this.tag, Context.api);
const clone = await this.repository.clone(this.tag.id, Shopware.Context.api, behavior);
return { id: clone.id };
diff --git a/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-seo/blog-tag-seo.html.twig b/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-seo/blog-tag-seo.html.twig
index 7841e3d..442f41a 100644
--- a/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-seo/blog-tag-seo.html.twig
+++ b/src/Resources/app/administration/src/module/blog-tag/component/blog-tag-seo/blog-tag-seo.html.twig
@@ -16,7 +16,7 @@
type="text"
:label="$tc('blog-tag.detail.labelIdentifier')"
:placeholder="$tc('blog-tag.detail.placeholderUrlKey')"
- :disabled="!allowEdit"
+ :disabled="true"
/>
{% endblock %}
diff --git a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-create/index.js b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-create/index.js
index adeb422..249d7de 100644
--- a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-create/index.js
+++ b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-create/index.js
@@ -18,6 +18,10 @@ Component.extend('blog-tag-create', 'blog-tag-detail', {
methods: {
createdComponent() {
+ if (!Shopware.State.getters['context/isSystemDefaultLanguage']) {
+ Shopware.State.commit('context/resetLanguageToDefault');
+ }
+
this.tag = this.tagRepository.create();
this.newId = this.tag.id;
diff --git a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/blog-tag-detail.html.twig b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/blog-tag-detail.html.twig
index 185e320..f67809e 100644
--- a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/blog-tag-detail.html.twig
+++ b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/blog-tag-detail.html.twig
@@ -45,6 +45,21 @@
{% endblock %}
+ {% block blog_tag_detail_language_switch %}
+
+
+
+ {% endblock %}
+
+ {% block blog_tag_detail_language_info %}
+
+ {% endblock %}
+
{% block blog_tag_detail_content %}
diff --git a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/index.js b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/index.js
index afe0f72..abe2d47 100644
--- a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/index.js
+++ b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-detail/index.js
@@ -7,7 +7,7 @@ import template from './blog-tag-detail.html.twig';
import slug from "slug";
const {Component, Mixin} = Shopware;
-const {Criteria} = Shopware.Data;
+const {Context, Data: {Criteria}} = Shopware;
Component.register('blog-tag-detail', {
template,
@@ -33,7 +33,7 @@ Component.register('blog-tag-detail', {
},
props: {
- tagId: {
+ id: {
type: String,
default: null,
},
@@ -45,6 +45,7 @@ Component.register('blog-tag-detail', {
isLoading: false,
isSaveSuccessful: false,
customFieldSets: null,
+ isChangedLanguage: Shopware.Context.api.languageId,
};
},
@@ -93,7 +94,13 @@ Component.register('blog-tag-detail', {
},
watch: {
- tagId() {
+ 'tag.title': function (value) {
+ if (value) {
+ let postIdentifier = slug(this.tag.title, '-');
+ this.buildIdentifier(postIdentifier, 1)
+ }
+ },
+ id() {
this.loadEntityData();
},
},
@@ -110,7 +117,7 @@ Component.register('blog-tag-detail', {
loadEntityData() {
this.isLoading = true;
- this.tagRepository.get(this.$attrs.id, Shopware.Context.api, this.defaultCriteria)
+ this.tagRepository.get(this.id, Shopware.Context.api, this.defaultCriteria)
.then((currentTag) => {
this.tag = currentTag;
this.isLoading = false;
@@ -118,6 +125,14 @@ Component.register('blog-tag-detail', {
this.isLoading = false;
});
},
+
+ onChangeLanguage(languageId) {
+
+ Shopware.State.commit('context/setApiLanguageId', languageId);
+
+ this.loadEntityData();
+ },
+
saveFinish() {
this.isSaveSuccessful = false;
},
@@ -126,16 +141,6 @@ Component.register('blog-tag-detail', {
this.isLoading = true;
return new Promise((resolve) => {
- let identifier = this.tag.identifier
- if (this.tag.title){
- if (identifier !== undefined && !this.isUrlValid(identifier)) {
- identifier = slug(identifier, '-');
- } else {
- identifier = slug(this.tag.title, '-');
- }
- }
-
- this.tag.identifier = identifier;
this.tagRepository.save(this.tag).then(() => {
this.isLoading = false;
this.isSaveSuccessful = true;
@@ -161,10 +166,18 @@ Component.register('blog-tag-detail', {
this.$router.push({name: 'blog.tag.index'});
},
- isUrlValid(str) { return /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/.test(str); },
-
- prepareIdentifier(str) {
- return str.replace(/ +/g, '-').toLowerCase();
- }
+ buildIdentifier(finalIdentifier, number) {
+ let numberItem = (number > 1 ? '-' + number : '');
+ const criteria = new Criteria();
+ criteria.addFilter(Criteria.equals('identifier', finalIdentifier + numberItem));
+ return this.tagRepository.search(criteria, Shopware.Context.api).then((result) => {
+ if (result.length === 0) {
+ return this.tag.identifier = slug(finalIdentifier + numberItem, '-');
+ } else {
+ number++;
+ this.buildIdentifier(finalIdentifier, number);
+ }
+ });
+ },
},
});
diff --git a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/blog-tag-list.html.twig b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/blog-tag-list.html.twig
index d1d1658..0af28e6 100644
--- a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/blog-tag-list.html.twig
+++ b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/blog-tag-list.html.twig
@@ -27,7 +27,7 @@
{% block blog_tag_list_smart_bar_actions %}
{% endblock %}
+ {% block blog_tag_list_language_switch %}
+
+
+
+ {% endblock %}
+
{% block blog_tag_list_content %}
diff --git a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/index.js b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/index.js
index 8c3deff..acddacb 100644
--- a/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/index.js
+++ b/src/Resources/app/administration/src/module/blog-tag/page/blog-tag-list/index.js
@@ -4,7 +4,7 @@
*/
const {Component, Mixin} = Shopware;
-const {Criteria} = Shopware.Data;
+const {Context, Data: { Criteria } } = Shopware;
import template from './blog-tag-list.html.twig';
@@ -30,8 +30,6 @@ Component.register('blog-tag-list', {
sortDirection: 'DESC',
naturalSorting: false,
total: 0,
- limit: 10,
- page: 1,
searchConfigEntity: 'magefanblog_tag',
};
},
@@ -105,9 +103,17 @@ Component.register('blog-tag-list', {
})
},
+ onChangeLanguage(languageId) {
+
+ Shopware.State.commit('context/setApiLanguageId', languageId);
+
+ this.getList();
+ },
+
updateTotal({total}) {
this.total = total;
},
+
onDuplicate(referenceTag) {
this.tag = referenceTag;
this.cloning = true;
diff --git a/src/Resources/app/administration/src/module/blog-tag/snippet/en-GB.json b/src/Resources/app/administration/src/module/blog-tag/snippet/en-GB.json
index 9fd1569..9429467 100644
--- a/src/Resources/app/administration/src/module/blog-tag/snippet/en-GB.json
+++ b/src/Resources/app/administration/src/module/blog-tag/snippet/en-GB.json
@@ -64,6 +64,12 @@
}
},
+ "sw-seo-url-template-card": {
+ "routeNames": {
+ "frontend-blog-tag": "Magefan Blog Tag"
+ }
+ },
+
"sw-privileges": {
"permissions": {
"blog_tag": {
diff --git a/src/Resources/app/storefront/src/scss/article.scss b/src/Resources/app/storefront/src/scss/article.scss
index edc6fec..d2e4a4c 100644
--- a/src/Resources/app/storefront/src/scss/article.scss
+++ b/src/Resources/app/storefront/src/scss/article.scss
@@ -196,7 +196,7 @@
}
}
.article-post__content {
- max-height: 120px;
+ max-height: 113px;
overflow: hidden;
p {
margin: 0 0 1rem 0;
diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml
index be725de..b3543af 100644
--- a/src/Resources/config/config.xml
+++ b/src/Resources/config/config.xml
@@ -238,7 +238,7 @@
Sidebar -> Category
sidebarCategoryEnabled
-
+
displayNumberOfPosts
-
+