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');
@@ -98,7 +98,7 @@ public function getPostsByCategory($category, $request, $context): EntityCollect
->addAssociation('postTags')
->addAssociation('postAuthor')
->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 0590e34..0eff1ec 100644
--- a/src/Core/Content/Blog/DataResolver/BlogListResolver.php
+++ b/src/Core/Content/Blog/DataResolver/BlogListResolver.php
@@ -18,15 +18,6 @@
class BlogListResolver
{
- /**
- * @var EntityRepositoryInterface
- */
- private EntityRepositoryInterface $blogAuthorRepository;
-
- /**
- * @var EntityRepositoryInterface
- */
- private EntityRepositoryInterface $blogCategoryRepository;
/**
* @var SystemConfigService
diff --git a/src/Core/Content/Blog/DataResolver/BlogPostResolver.php b/src/Core/Content/Blog/DataResolver/BlogPostResolver.php
index 5695581..25970e3 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 95e4ae7..68ca075 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/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 028eb0c..7271cbf 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..2fff264
--- /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/config/services.xml b/src/Resources/config/services.xml
index 7da4391..fd3db58 100644
--- a/src/Resources/config/services.xml
+++ b/src/Resources/config/services.xml
@@ -9,8 +9,27 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -63,6 +82,7 @@
+
@@ -168,6 +188,15 @@
+
+
+
+
+
+
+
+
+
@@ -190,4 +219,4 @@
-
\ No newline at end of file
+
diff --git a/src/Resources/public/administration/js/magefan-blog.js b/src/Resources/public/administration/js/magefan-blog.js
index e843839..adce99b 100644
--- a/src/Resources/public/administration/js/magefan-blog.js
+++ b/src/Resources/public/administration/js/magefan-blog.js
@@ -1,3 +1,3 @@
/*! For license information please see magefan-blog.js.LICENSE.txt */
-!function(e){var t={};function n(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(o,a,function(t){return e[t]}.bind(null,a));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/bundles/magefanblog/",n(n.s="oQZz")}({"1By9":function(e,t,n){},"33yf":function(e,t,n){(function(e){function n(e,t){for(var n=0,o=e.length-1;o>=0;o--){var a=e[o];"."===a?e.splice(o,1):".."===a?(e.splice(o,1),n++):n&&(e.splice(o,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function o(e,t){if(e.filter)return e.filter(t);for(var n=[],o=0;o
=-1&&!a;r--){var i=r>=0?arguments[r]:e.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");i&&(t=i+"/"+t,a="/"===i.charAt(0))}return(a?"/":"")+(t=n(o(t.split("/"),(function(e){return!!e})),!a).join("/"))||"."},t.normalize=function(e){var r=t.isAbsolute(e),i="/"===a(e,-1);return(e=n(o(e.split("/"),(function(e){return!!e})),!r).join("/"))||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(o(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,n){function o(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var a=o(e.split("/")),r=o(n.split("/")),i=Math.min(a.length,r.length),l=i,s=0;s=1;--r)if(47===(t=e.charCodeAt(r))){if(!a){o=r;break}}else a=!1;return-1===o?n?"/":".":n&&1===o?"/":e.slice(0,o)},t.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,o=-1,a=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!a){n=t+1;break}}else-1===o&&(a=!1,o=t+1);return-1===o?"":e.slice(n,o)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,o=-1,a=!0,r=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47!==l)-1===o&&(a=!1,o=i+1),46===l?-1===t?t=i:1!==r&&(r=1):-1!==t&&(r=-1);else if(!a){n=i+1;break}}return-1===t||-1===o||0===r||1===r&&t===o-1&&t===n+1?"":e.slice(t,o)};var a="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n("8oxB"))},"49sm":function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},"5Cm7":function(e){e.exports=JSON.parse('{"blog-comment":{"general":{"cardTitle":"General information","title":"Blog Comments","mainMenuItemList":"Blog Comments","descriptionTextModule":"Blog plugin for Shopware store","publishDateLabel":"Publish Date","publishDatePlaceholder":"Select publish date...","textLabel":"Text","textPlaceholder":"Enter text...","labelAuthor":"Author","labelPost":"Post","labelParentComment":"Parent Comment"},"list":{"title":"Comments","titleColumn":"Title","descColumn":"Description","titleSaveSuccess":"Success","messageSaveSuccess":"Details updated successfully","labelStatus":"Status","labelModified":"Modified","labelPublished":"Published","labelAuthorType":"Author Type","labelPost":"Post","labelNickName":"Author Nickname","labelText":"Text"},"detail":{"header":{"titleEdit":"Comment"},"statuses":{"pending":"Pending","approved":"Approved","not_approved":"Not Approved","statusLabel":"Status"},"cancelButton":"Cancel","saveButton":"Save","labelPublishDate":"Publish Date","labelText":"Text","labelStatus":"Status","cardTitle":"Setting","buttonAddComment":"Add Comment"}},"sw-privileges":{"permissions":{"blog_comment":{"label":"Blog Comment"}}}}')},"8oxB":function(e,t){var n,o,a=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:r}catch(e){n=r}try{o="function"==typeof clearTimeout?clearTimeout:i}catch(e){o=i}}();var s,c=[],d=!1,p=-1;function g(){d&&s&&(d=!1,s.length?c=s.concat(c):p=-1,c.length&&u())}function u(){if(!d){var e=l(g);d=!0;for(var t=c.length;t;){for(s=c,c=[];++p1)for(var n=1;n0?i-4:i;for(n=0;n>16&255,s[d++]=t>>8&255,s[d++]=255&t;2===l&&(t=a[e.charCodeAt(n)]<<2|a[e.charCodeAt(n+1)]>>4,s[d++]=255&t);1===l&&(t=a[e.charCodeAt(n)]<<10|a[e.charCodeAt(n+1)]<<4|a[e.charCodeAt(n+2)]>>2,s[d++]=t>>8&255,s[d++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,a=n%3,r=[],i=16383,l=0,s=n-a;ls?s:l+i));1===a?(t=e[n-1],r.push(o[t>>2]+o[t<<4&63]+"==")):2===a&&(t=(e[n-2]<<8)+e[n-1],r.push(o[t>>10]+o[t>>4&63]+o[t<<2&63]+"="));return r.join("")};for(var o=[],a=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,s=i.length;l0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function d(e,t,n){for(var a,r,i=[],l=t;l>18&63]+o[r>>12&63]+o[r>>6&63]+o[63&r]);return i.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},Ijbi:function(e,t,n){var o=n("WkPL");e.exports=function(e){if(Array.isArray(e))return o(e)},e.exports.__esModule=!0,e.exports.default=e.exports},MK3V:function(e,t){Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:"content",key:"blog_category",roles:{viewer:{privileges:["magefanblog_category:create","magefanblog_category:update","magefanblog_category:read","magefanblog_post_category:create","magefanblog_post_category:update","magefanblog_post_category:read"],dependencies:[]},editor:{privileges:["magefanblog_category:create","magefanblog_category:delete","magefanblog_author:create","magefanblog_author:delete"],dependencies:["blog_category.viewer"]},creator:{privileges:["magefanblog_category:create","magefanblog_author:create"],dependencies:["blog_category.viewer","blog_category.editor"]},deleter:{privileges:["magefanblog_category:delete","magefanblog_author:delete"],dependencies:["blog_category.viewer"]}}})},RIqP:function(e,t,n){var o=n("Ijbi"),a=n("EbDI"),r=n("ZhPi"),i=n("Bnag");e.exports=function(e){return o(e)||a(e)||r(e)||i()},e.exports.__esModule=!0,e.exports.default=e.exports},SZ7m:function(e,t,n){"use strict";function o(e,t){for(var n=[],o={},a=0;an.parts.length&&(o.parts.length=n.parts.length)}else{var i=[];for(a=0;ae.length)&&(t=e.length);for(var n=0,o=new Array(t);n>1,d=-7,p=n?a-1:0,g=n?-1:1,u=e[t+p];for(p+=g,r=u&(1<<-d)-1,u>>=-d,d+=l;d>0;r=256*r+e[t+p],p+=g,d-=8);for(i=r&(1<<-d)-1,r>>=-d,d+=o;d>0;i=256*i+e[t+p],p+=g,d-=8);if(0===r)r=1-c;else{if(r===s)return i?NaN:1/0*(u?-1:1);i+=Math.pow(2,o),r-=c}return(u?-1:1)*i*Math.pow(2,r-o)},t.write=function(e,t,n,o,a,r){var i,l,s,c=8*r-a-1,d=(1<>1,g=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,u=o?0:r-1,f=o?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,i=d):(i=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-i))<1&&(i--,s*=2),(t+=i+p>=1?g/s:g*Math.pow(2,1-p))*s>=2&&(i++,s/=2),i+p>=d?(l=0,i=d):i+p>=1?(l=(t*s-1)*Math.pow(2,a),i+=p):(l=t*Math.pow(2,p-1)*Math.pow(2,a),i=0));a>=8;e[n+u]=255&l,u+=f,l/=256,a-=8);for(i=i<0;e[n+u]=255&i,u+=f,i/=256,c-=8);e[n+u-f]|=128*h}},l0Wh:function(e){e.exports=JSON.parse('{"blog-post":{"general":{"title":"Blog Posts","mainMenuItemList":"Blog Posts","descriptionTextModule":"Blog post plugin for Shopware store","layoutUpdateLabel":"Layout Update","useAsImage":"Use as display image"},"list":{"titleColumn":"Title","descColumn":"Description","titleSaveSuccess":"Success","addPostButton":"Add post","buttonDuplicate":"Duplicate","messageSaveSuccess":"Details updated successfully","labelActive":"Status","labelAuthor":"Author","labelUpdatedAt":"Modified","labelCreatedAt":"Posted","labelCategory":"Category","labelUrlKey":"Url Key","labelTitle":"Title","deleteOption":"Delete","editOption":"Edit","buttonCancel":"Cancel","buttonDelete":"Delete","textDeleteConfirm":"Are you sure you really want to delete the element \\"{name}\\"?"},"detail":{"textHeadline":"Post Detail","buttonCancel":"Cancel","buttonSave":"Save","cardTitleGeneralInfo":"General","cardTitleLayoutInfo":"Layout","layoutLabel":"Layout","messageSaveError":"Saving error, please try again","emptyLayout":"Empty","oneColumnLayout":"1 column","columnsWithLeftLayout":"2 columns with left sidebar","columnsWithRightLayout":"2 columns with right sidebar","3columnsLayout":"3 columns","layoutUpdateLabel":"Layout Update","labelDisplayRobotsType":"Robots","labelTitle":"Post Title","cardTitleDisplaySettingInfo":"Display Setting","labelPostPerPage":"Posts Per Page","labelTemplate":"Template","cardSeoGroupInfo":"Search Engine Optimization","defaultTemplate":"Default","modernTemplate":"Modern","labelIdentifier":"Url Key","labelMetaTitle":"Meta Title","labelMetaKeywords":"Meta Keywords","labelMetaDescription":"Meta Description","configRobots":"Use config settings","indexFollow":"INDEX, FOLLOW","noindexFollow":"NOINDEX, FOLLOW","indexNofollow":"INDEX, NOFOLLOW","noindexNofollow":"NOINDEX, NOFOLLOW","categoryLabel":"Categories","placeholderCategories":"Choose a category...","labelImage":"Feature Image","cardTitleImageUpload":"Feature Image","cardTitleRelated":"Related Posts and Products","labelCategories":"Categories","labelTags":"Tags","labelAuthor":"Author","labelActive":"Enable Post","labelShortContent":"Short Content","labelContent":"Content","cardShortContent":"Short Content","labelPublishDate":"Publish Date","labelIncludeInRecent":"Include in Recent Posts","placeholderViewsCount":"Type view count here...","placeholderPostPosition":"Type post position here...","placeholderTags":"Select tag...","placeholderShortContent":"Type short content here...","placeholderMetaDescription":"Type meta description here...","placeholderMetaTitle":"Type meta title here...","placeholderMetaKeywords":"Type meta keywords here...","placeholderUrlKey":"Type URL key here...","labelNoCategorySelected":"No category selected","cardOpenGraphMetadata":"Open Graph Metadata","labelOgTitle":"Og Title","placeholderOgTitle":"Type og title...","labelOgDescription":"Og Description","placeholderOgDescription":"Type og description here... ","labelOgType":"Og Type","placeholderOgType":"Type og type here...","labelImageAlt":"Feature Image Alt","labelViewCount":"Views count","labelPosition":"Position","placeholderAuthor":"Author","placeholderTitle":"Type post title here...","placeholderContent":"Type post content here...","placeholderImageAlt":"Type image alt here..."},"tooltip":{"warning":"Warning"}},"sw-privileges":{"permissions":{"blog_post":{"label":"Blog Post"}}}}')},ls82:function(e,t,n){var o=function(e){"use strict";var t,n=Object.prototype,o=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},r=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,o){var a=t&&t.prototype instanceof b?t:b,r=Object.create(a.prototype),i=new P(o||[]);return r._invoke=function(e,t,n){var o=p;return function(a,r){if(o===u)throw new Error("Generator is already running");if(o===f){if("throw"===a)throw r;return L()}for(n.method=a,n.arg=r;;){var i=n.delegate;if(i){var l=C(i,n);if(l){if(l===h)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=u;var s=d(e,t,n);if("normal"===s.type){if(o=n.done?f:g,s.arg===h)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=f,n.method="throw",n.arg=s.arg)}}}(e,n,i),r}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var p="suspendedStart",g="suspendedYield",u="executing",f="completed",h={};function b(){}function m(){}function y(){}var _={};_[r]=function(){return this};var v=Object.getPrototypeOf,w=v&&v(v(A([])));w&&w!==n&&o.call(w,r)&&(_=w);var S=y.prototype=b.prototype=Object.create(_);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(a,r,i,l){var s=d(e[a],e,r);if("throw"!==s.type){var c=s.arg,p=c.value;return p&&"object"==typeof p&&o.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(p).then((function(e){c.value=e,i(c)}),(function(e){return n("throw",e,i,l)}))}l(s.arg)}var a;this._invoke=function(e,o){function r(){return new t((function(t,a){n(e,o,t,a)}))}return a=a?a.then(r,r):r()}}function C(e,n){var o=e.iterator[n.method];if(o===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method))return h;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var a=d(o,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,h;var r=a.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,h):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function A(e){if(e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,i=function n(){for(;++a=0;--r){var i=this.tryEntries[r],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&o.call(a,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var a=o.arg;E(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,o){return this.delegate={iterator:A(e),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=o}catch(e){Function("r","regeneratorRuntime = r")(o)}},m0Ej:function(e){e.exports=JSON.parse('{"blog-category":{"general":{"title":"Blog Categories","mainMenuItemList":"Blog Categories","descriptionTextModule":"Blog plugin for Shopware store"},"list":{"titleColumn":"Title","descColumn":"Description","titleSaveSuccess":"Success","messageSaveSuccess":"Details updated successfully","headerText":"Categories","addCategoryButton":"Add New Category","labelActive":"Status","labelUrlKey":"Url Key","labelTitle":"Title","editOption":"Edit","deleteOption":"Delete","buttonCancel":"Cancel","buttonDelete":"Delete","textDeleteConfirm":"Are you sure you really want to delete the element \\"{name}\\"?"},"detail":{"labelMetaTitle":"Meta Title","labelMetaKeywords":"Meta Keywords","labelMetaDescription":"Meta Description","configRobots":"Use config settings","indexFollow":"INDEX, FOLLOW","noindexFollow":"NOINDEX, FOLLOW","indexNofollow":"INDEX, NOFOLLOW","noindexNofollow":"NOINDEX, NOFOLLOW","labelDisplayRobotsType":"Robots Type","cardTitleDisplaySettingInfo":"Display Setting","labelPostPerPage":"Posts Per Page","labelTemplate":"Template","cardSeoGroupInfo":"Search Engine Optimization","defaultTemplate":"Default","modernTemplate":"Modern","labelIdentifier":"Identifier","textHeadline":"Author Detail","buttonCancel":"Cancel","buttonSave":"Save","cardTitleGeneralInfo":"General","cardTitleLayoutInfo":"Layout","layoutLabel":"Layout","buttonAddCategory":"Add New Category","labelIncludeInMenu":"Include In Menu","labelContent":"Content","labelPosition":"Position","placeholderMetaDescription":"Type meta description here...","placeholderMetaKeywords":"Type meta keyword here...","placeholderMetaTitle":"Type meta title here...","placeholderUrlKey":"Type url key here...","placeholderPostsPerPage":"Type posts per page here...","labelActive":"Enable Category","labelTitle":"Title","placeholderTitle":"Type category title here...","placeholderPosition":"Type category position here...","placeholderContent":"Type content here...","labelSortBy":"Posts Sort By","defaultSort":"Publish Date (default)","positionSort":"Position","titleSort":"Title"}},"sw-privileges":{"permissions":{"blog_category":{"label":"Blog Category"}}}}')},o0o1:function(e,t,n){e.exports=n("ls82")},"o9+4":function(e,t,n){(function(t){!function(n){let o;function a(e,t){const n=e.charCodeAt(t);if(isNaN(n))throw new RangeError("Index "+t+' out of range for string "'+e+'"; please open an issue at https://github.com/Trott/slug/issues/new');if(n<55296||n>57343)return[e.charAt(t),t];if(n>=55296&&n<=56319){if(e.length<=t+1)return[" ",t];const n=e.charCodeAt(t+1);return n<56320||n>57343?[" ",t]:[e.charAt(t)+e.charAt(t+1),t+1]}if(0===t)return[" ",t];const o=e.charCodeAt(t-1);if(o<55296||o>56319)return[" ",t];throw new Error('String "'+e+'" reaches code believed to be unreachable; please open an issue at https://github.com/Trott/slug/issues/new')}function r(e,t){let n=s(e,t);if(!0===(t&&void 0!==t.fallback?t.fallback:r.defaults.fallback)&&""===n){let r="";for(let t=0;t>8-a%1*8)){if(o=t.charCodeAt(a+=3/4),o>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|o}return n}:function(e){return t.from(e).toString("base64")};const i={bg:{"Й":"Y","й":"y",X:"H",x:"h","Ц":"Ts","ц":"ts","Щ":"Sht","щ":"sht","Ъ":"A","ъ":"a","Ь":"Y","ь":"y"},de:{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue"},sr:{"đ":"dj","Đ":"DJ"},uk:{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"}};let l={};function s(e,t){if("string"!=typeof e)throw new Error("slug() requires a string argument, received "+typeof e);"string"==typeof t&&(t={replacement:t}),(t=t?Object.assign({},t):{}).mode=t.mode||r.defaults.mode;const n=r.defaults.modes[t.mode],o=["replacement","multicharmap","charmap","remove","lower","trim"];for(let e,a=0,r=o.length;a1?n[t[a]]=e[t[a]]:o[t[a]]=e[t[a]];Object.assign(r.charmap,o),Object.assign(r.multicharmap,n)},r.setLocale=function(e){l=i[e]||{}},e.exports?e.exports=r:n.slug=r}(this)}).call(this,n("tjlA").Buffer)},oFtQ:function(e,t){Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:"content",key:"blog_tag",roles:{viewer:{privileges:["magefanblog_tag:create","magefanblog_tag:update","magefanblog_tag:read","magefanblog_post_tag:create","magefanblog_post_tag:update","magefanblog_post_tag:read"],dependencies:[]},editor:{privileges:["magefanblog_tag:create","magefanblog_tag:delete","magefanblog_post_tag:create","magefanblog_post_tag:delete"],dependencies:["blog_tag.viewer"]},creator:{privileges:["magefanblog_tag:create","magefanblog_post_tag:create"],dependencies:["blog_tag.viewer","blog_tag.editor"]},deleter:{privileges:["magefanblog_tag:delete","magefanblog_post_tag:delete"],dependencies:["blog_tag.viewer"]}}})},oQZz:function(e,t,n){"use strict";n.r(t);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw i}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n\n {% block blog_post_list_smart_bar_header %}\n \n {% block blog_post_list_smart_bar_header_title %}\n \n {% block blog_post_list_smart_bar_header_title_text %}\n {{ $tc(\'blog-post.general.mainMenuItemList\') }}\n {% endblock %}\n\n {% block blog_post_list_smart_bar_header_amount %}\n \n ({{ total }})\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n\n {% block blog_post_list_actions %}\n \n {% block blog_post_list_smart_bar_actions %}\n \n {{ $tc(\'blog-post.list.addPostButton\') }}\n \n {% endblock %}\n \n {% endblock %}\n\n \n {% block blog_post_list_content %}\n \n {% block blog_post_list_grid %}\n
\n {% block blog_post_list_grid_columns_actions %}\n \n \n {{ $tc(\'blog-post.list.editOption\') }}\n \n\n \n {{ $tc(\'blog-post.list.deleteOption\') }}\n \n \n {% endblock %}\n {% block blog_post_list_grid_action_modals %}\n \n\n {% block blog_post_list_delete_modal %}\n \n\n {% block blog_post_list_delete_modal_confirm_delete_text %}\n \n {{ $tc(\'blog-post.list.textDeleteConfirm\', 0, { name: `${item.title}` }) }}\n
\n {% endblock %}\n\n {% block blog_post_list_delete_modal_footer %}\n \n\n {% block blog_post_list_delete_modal_cancel %}\n \n {{ $tc(\'blog-post.list.buttonCancel\') }}\n \n {% endblock %}\n\n {% block blog_post_list_delete_modal_confirm %}\n \n {{ $tc(\'blog-post.list.buttonDelete\') }}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n {# {% block blog_post_list_grid_columns_actions_duplicate %}\n \n {{ $tc(\'blog-post.list.buttonDuplicate\') }}\n \n {% endblock %} #}\n \n \n \n \n {{ item }}\n \n \n {{ item }}\n \n \n \n \n \n {{ category.title }}\n \n , \n \n \n \n {{ $tc(\'blog-post.detail.labelNoCategorySelected\') }}\n \n \n \n \n \n \n {{ item.createdAt|date }}\n \n \n \n {{ item.updatedAt|date }}\n \n\n \n {{ item.createdAt|date }}\n \n \n \n {% endblock %}\n {# {% block blog_post_list_content_clone_modal %}\n
\n {% endblock %} #}\n
\n {% endblock %}\n \n \n{% endblock %}\n\n\n',inject:["repositoryFactory","acl"],mixins:[l.getByName("notification")],data:function(){return{posts:null,repository:{},isLoading:!0,cloning:!1,sortBy:"createdAt",sortDirection:"DESC",naturalSorting:!1,total:0,limit:10,page:1,showDeleteModal:!1,searchConfigEntity:"magefanblog_post"}},metaInfo:function(){return{title:this.$createTitle()}},computed:{postRepository:function(){return this.repositoryFactory.create("magefanblog_post")},commentRepository:function(){return this.repositoryFactory.create("magefanblog_comment")},columns:function(){return[{property:"title",dataIndex:"title",routerLink:"blog.post.detail",label:this.$t("blog-post.list.labelTitle"),inlineEdit:"string",allowResize:!0,sortable:!1},{property:"identifier",dataIndex:"identifier",label:this.$t("blog-post.list.labelUrlKey"),inlineEdit:"string",allowResize:!0,sortable:!1},{property:"categories",dataIndex:"categories",label:this.$t("blog-post.list.labelCategory"),allowResize:!0,sortable:!1},{property:"authorId",dataIndex:"author_id",label:this.$t("blog-post.list.labelAuthor"),allowResize:!0,sortable:!1},{property:"createdAt",dataIndex:"created_at",label:this.$t("blog-post.list.labelCreatedAt"),allowResize:!0,sortable:!1},{property:"updatedAt",dataIndex:"updated_at",label:this.$t("blog-post.list.labelUpdatedAt"),allowResize:!0,sortable:!1},{property:"isActive",dataIndex:"is_active",label:this.$t("blog-post.list.labelActive"),inlineEdit:"boolean",allowResize:!0,type:"bool",align:"center",sortable:!1}]}},created:function(){this.getList()},beforeRouteLeave:function(e,t,n){this.$nextTick((function(){n()}))},methods:{onDelete:function(e){this.showDeleteModal=e},onCloseDeleteModal:function(){this.showDeleteModal=!1},onConfirmDelete:function(e){var t=this;this.showDeleteModal=!1;var n=new s;n.addFilter(s.equals("postId",e)),this.commentRepository.search(n).then((function(e){if(e){var n,a=o(e);try{for(a.s();!(n=a.n()).done;){var r=n.value;t.commentRepository.delete(r.id,Shopware.Context.api).then((function(){}))}}catch(e){a.e(e)}finally{a.f()}}})),this.postRepository.delete(e,Shopware.Context.api).then((function(){t.getList()}))},onPageChange:function(e){var t=e.page,n=e.limit;this.page=t,this.limit=n,this.$emit("page-change")},getList:function(){var e=this;this.isLoading=!0;var t=new s(this.page,this.limit);t.addSorting(s.sort(this.sortBy,this.sortDirection,this.naturalSorting)),t.addAssociation("postCategories"),t.addAssociation("postAuthor"),this.repository=this.repositoryFactory.create("magefanblog_post"),this.repository.search(t).then((function(t){e.posts=t,e.total=t.total,e.isLoading=!1}))},updateTotal:function(e){var t=e.total;this.total=t},onDuplicate:function(e){this.post=e,this.cloning=!0},onDuplicateFinish:function(e){var t=this;this.cloning=!1,this.post=null,this.$nextTick((function(){t.$router.push({name:"blog.post.detail",params:{postId:e.id}})}))}}});var c=n("o9+4"),d=n.n(c);function p(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,r=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw r}}}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n\n {% block blog_post_detail_smart_bar_header %}\n \n\n {% block blog_post_detail_smart_bar_header_title %}\n {{ placeholder(post, \'title\', $tc(\'blog-post.detail.textHeadline\')) }} \n {% endblock %}\n\n \n {% endblock %}\n\n {% block blog_post_detail_smart_bar_actions %}\n \n {% block blog_post_detail_smart_bar_actions_cancel %}\n \n {{ $tc(\'blog-post.detail.buttonCancel\') }}\n \n {% endblock %}\n\n {% block blog_post_detail_smart_bar_actions_save %}\n \n {{ $tc(\'blog-post.detail.buttonSave\') }}\n \n {% endblock %}\n \n {% endblock %}\n\n {% block blog_post_detail_content %}\n \n \n \n \n \n\n \n\n {% block blog_post_detail_base %}\n \n {% endblock %}\n\n {% block blog_post_short_content %}\n \n {% endblock %}\n\n {% block blog_post_display_setting %}\n \n {% endblock %}\n\n {% block blog_post_media_form %}\n \n {% endblock %}\n\n {% block blog_post_seo %}\n \n {% endblock %}\n\n
\n \n {% endblock %}\n {% block blog_post_sidebar %}\n \n \n \n \n \n {{ $tc(\'blog-post.general.useAsImage\') }}\n \n \n \n \n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","acl","customFieldDataProviderService"],mixins:[h.getByName("notification"),h.getByName("placeholder")],shortcuts:{"SYSTEMKEY+S":{active:function(){return this.acl.can("blog_post.editor")},method:"onSave"},ESCAPE:"onCancel"},props:{postId:{type:String,default:null}},data:function(){return{post:null,categories:null,tags:null,isLoading:!1,isSaveSuccessful:!1,customFieldSets:null,tagItem:{},categoryItem:{},existTag:!1,existCategory:!1}},metaInfo:function(){return{title:this.$createTitle(this.identifier)}},computed:{identifier:function(){return this.placeholder(this.post,"position")},optionRepository:function(){return this.repositoryFactory.create("magefanblog_post")},postRepository:function(){return this.repositoryFactory.create("magefanblog_post")},postCategoryRepository:function(){return this.repositoryFactory.create("magefanblog_post_category")},postTagRepository:function(){return this.repositoryFactory.create("magefanblog_post_tag")},tooltipSave:function(){if(!this.acl.can("blog_post.editor"))return{message:this.$tc("blog-post.tooltip.warning"),disabled:this.acl.can("blog_post.editor"),showOnDisabledElements:!0};var e=this.$device.getSystemKey();return{message:"".concat(e," + S"),appearance:"light"}},tooltipCancel:function(){return{message:"ESC",appearance:"light"}},defaultCriteria:function(){return new m(this.page,this.limit)},useNaturalSorting:function(){return"post.title"===this.sortBy},showCustomFields:function(){return this.post&&this.customFieldSets&&this.customFieldSets.length>0}},watch:{postId:function(){this.loadEntityData()}},created:function(){this.createdComponent()},methods:{createdComponent:function(){this.loadEntityData()},getTags:function(e){this.tags=e},getCategories:function(e){this.categories=e},loadEntityData:function(){var e=this;this.isLoading=!0,this.postRepository.get(this.$attrs.id,Shopware.Context.api,this.defaultCriteria).then((function(t){e.post=t,e.isLoading=!1})).catch((function(){e.isLoading=!1}))},saveFinish:function(){this.isSaveSuccessful=!1},savePost:function(){var e=this;return this.isLoading=!0,new Promise((function(t){var n=e.post.identifier;e.post.title&&(n=void 0===n||e.isUrlValid(n)?d()(e.post.title,"-"):d()(n,"-"),e.post.identifier=n),e.updateCategories(),e.updateTags(),e.postRepository.save(e.post).then((function(){e.isLoading=!1,e.isSaveSuccessful=!0,e.post.id&&e.$router.push({name:"blog.post.detail",params:{id:e.post.id}})})).catch((function(t){throw e.isLoading=!1,e.isSaveSuccessful=!1,e.createNotificationError({message:e.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),t}))}))},onSave:function(){return this.savePost()},updateCategories:function(){var e=this;if(this.categories){var t,n=p(this.categories);try{var o=function(){var n=t.value;e.checkCategoryExists(n).then((function(t){e.existCategory&&(e.categoryItem=e.postCategoryRepository.create(),e.categoryItem.categoryId=n,e.categoryItem.postId=e.post.id,e.postCategoryRepository.save(e.categoryItem).then((function(){})).catch((function(e){})))}))};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}var a=new m;a.addFilter(m.equals("postId",this.post.id)),this.postCategoryRepository.search(a).then((function(t){if(t){var n,o=p(t);try{for(o.s();!(n=o.n()).done;){var a=n.value;e.categories.includes(a.categoryId)||e.postCategoryRepository.delete(a.id,b.api).then((function(){}))}}catch(e){o.e(e)}finally{o.f()}}}))}},updateTags:function(){var e=this;if(this.tags){var t,n=p(this.tags);try{var o=function(){var n=t.value;e.checkTagExists(n).then((function(t){t&&(e.tagItem=e.postTagRepository.create(),e.tagItem.tagId=n,e.tagItem.postId=e.post.id,e.postTagRepository.save(e.tagItem).then((function(){})).catch((function(e){})))}))};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}var a=new m;a.addFilter(m.equals("postId",this.post.id)),this.postTagRepository.search(a).then((function(t){if(t){var n,o=p(t);try{for(o.s();!(n=o.n()).done;){var a=n.value;e.tags.includes(a.tagId)||e.postTagRepository.delete(a.id,b.api).then((function(){}))}}catch(e){o.e(e)}finally{o.f()}}}))},onlyUnique:function(e,t,n){return n.indexOf(e)===t},onCancel:function(){this.$router.push({name:"blog.post.index"})},isUrlValid:function(e){return/^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/.test(e)},checkCategoryExists:function(e){var t=this,n=new m;return n.addFilter(m.equals("categoryId",e)),n.addFilter(m.equals("postId",this.post.id)),this.postCategoryRepository.search(n,this.context).then((function(e){return t.existCategory=0===e.total}))},checkTagExists:function(e){var t=this,n=new m;return n.addFilter(m.equals("postId",this.post.id)),n.addFilter(m.equals("tagId",e)),this.postTagRepository.search(n,this.context).then((function(e){return t.existTag=0===e.total}))}}});Shopware.Component.extend("blog-post-create","blog-post-detail",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_post_create %}\n\n {% block blog_post_create_content_option_list %}\n \n \n {% endblock %}\n{% endblock %}\n',data:function(){return{newId:null}},methods:{createdComponent:function(){this.post=this.postRepository.create(),this.newId=this.post.id,this.isLoading=!1},saveFinish:function(){this.isSaveSuccessful=!1,this.$router.push({name:"blog.post.detail",params:{id:this.newId}})},onSave:function(){this.$super("onSave")}}});function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,r=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw r}}}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n\n\n {% block blog_post_detail_active %}\n \n {% endblock %}\n\n {% block blog_post_detail_title %}\n \n \n {% endblock %}\n\n {% block blog_post_detail_select_categories %}\n \n \n {% endblock %}\n\n {% block blog_post_detail_content %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","acl"],mixins:[T.getByName("placeholder")],props:{post:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},data:function(){return{categories:[],categoriesSelected:[],activeDefault:1}},computed:function(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,r=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw r}}}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n\n\n {% block blog_post_detail_author %}\n \n {% endblock %}\n\n {% block blog_post_detail_tags %}\n \n \n {% endblock %}\n\n {% block blog_post_detail_include_in_recent %}\n \n {% endblock %}\n\n {% block blog_post_detail_position %}\n \n {% endblock %}\n\n\n{% endblock %}\n',inject:["repositoryFactory","acl"],mixins:[O.getByName("placeholder")],props:{post:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},created:function(){this.initValues(),this.checkAuthorExist(),this.post.title||(this.post.includeInRecent=!0)},data:function(){return{tags:[],tagsSelected:[],authorItem:{}}},computed:{getAdminUser:function(){return Shopware.State.get("session").currentUser},authorRepository:function(){return this.repositoryFactory.create("magefanblog_author")},tagRepository:function(){return this.repositoryFactory.create("magefanblog_tag")},postRepository:function(){return this.repositoryFactory.create("magefanblog_post")}},methods:{initValues:function(){this.getAllTags(),this.getSelectedTags()},getAllTags:function(){var e=this,t=new I;this.tagRepository.search(t).then((function(t){var n,o=[],a=E(t);try{for(a.s();!(n=a.n()).done;){var r=n.value;o.push({value:r.id,label:r.title})}}catch(e){a.e(e)}finally{a.f()}e.tags=o}))},getSelectedTags:function(){var e=this,t=new I;t.addAssociation("postTags"),t.addFilter(I.equals("id",this.post.id)),this.postRepository.search(t,Shopware.Context.api).then((function(t){var n=[];if(void 0!==t[0]){var o,a=E(t[0].postTags);try{for(a.s();!(o=a.n()).done;){var r=o.value;n.push(r.id)}}catch(e){a.e(e)}finally{a.f()}}e.tagsSelected=n,e.$emit("tags",e.tagsSelected)}))},updateSelectedTags:function(e){this.tagsSelected=e,this.$emit("tags",this.tagsSelected)},checkAuthorExist:function(){var e=this,t=new I;t.addFilter(I.equals("adminUserId",this.getAdminUser.id)),this.authorRepository.search(t,Shopware.Context.api).then((function(t){0!==t.total||e.post.authorId?e.post.authorId||(e.post.authorId=t[0].id):(e.authorItem=e.authorRepository.create(),e.authorItem.firstname=e.getAdminUser.firstName,e.authorItem.lastname=e.getAdminUser.lastName,e.authorItem.adminUserId=e.getAdminUser.id,e.authorRepository.save(e.authorItem).then((function(t){var n=JSON.parse(t.config.data);n.id&&(e.post.authorId=n.id)})))}))}}});var D=Shopware,M=D.Component,R=D.Mixin;M.register("blog-post-seo",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_post_seo %}\n\n\n {% block blog_post_seo_identifier %}\n \n {% endblock %}\n\n {% block blog_post_seo %}\n \n {% endblock %}\n\n {% block blog_post_seo_meta_keywords %}\n \n {% endblock %}\n\n {% block blog_post_seo_meta_description %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["acl"],mixins:[R.getByName("placeholder")],props:{post:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1}}});function $(e,t,n,o,a,r,i){try{var l=e[r](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,a)}var N=Shopware.Component,B=Shopware.Data.Criteria;N.register("blog-post-clone-modal",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block sw_product_clone_modal %}\n\n {% block sw_product_clone_modal_description %}\n \n {{ $tc(\'sw-product.general.cloneNotice\') }}\n
\n {% endblock %}\n\n {% block sw_product_clone_modal_progress_bar %}\n \n {% endblock %}\n\n {% block sw_product_clone_modal_progress_bar_description %}\n \n {{ cloneProgress }} {{ $tc(\'sw-product.variations.progressTypeOf\') }} {{ cloneMaxProgress }} {{ $tc(\'sw-product.general.cloneSuffix\') }}\n
\n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","numberRangeService"],props:{post:{type:Object,required:!0}},data:function(){return{cloningVariants:!1,cloneMaxProgress:0,cloneProgress:0}},computed:{progressInPercenposte:function(){return 100/this.cloneMaxProgress*this.cloneProgress},repository:function(){return this.repositoryFactory.create("magefanblog_post")}},created:function(){this.createdComponent()},methods:{createdComponent:function(){this.duplicate()},duplicate:function(){this.numberRangeService.reserve("post").then(this.cloneParent).then(this.verifyVariants)},cloneParent:function(e){var t,n=this;return(t=regeneratorRuntime.mark((function e(){var t,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={cloneChildren:!1,overwrites:{title:"".concat(n.post.title," ").concat(n.$tc("global.default.copy")),active:!1}},e.next=3,n.repository.save(n.post);case 3:return e.next=5,n.repository.clone(n.post.id,Shopware.Context.api,t);case 5:return o=e.sent,e.abrupt("return",{id:o.id});case 7:case"end":return e.stop()}}),e)})),function(){var e=this,n=arguments;return new Promise((function(o,a){var r=t.apply(e,n);function i(e){$(r,o,a,i,l,"next",e)}function l(e){$(r,o,a,i,l,"throw",e)}i(void 0)}))})()},verifyVariants:function(e){var t=this;this.getChildrenIds().then((function(n){n.length<=0?t.$emit("clone-finish",{id:e.id}):(t.cloningVariants=!0,t.cloneProgress=1,t.cloneMaxProgress=n.length,t.duplicateVariant(e,n,(function(){t.cloningVariants=!1,t.$emit("clone-finish",{id:e.id})})))}))},getChildrenIds:function(){var e=new B(1,null);return this.repository.searchIds(e).then((function(e){return e.data}))},duplicateVariant:function(e,t,n){var o=this;if(t.length<=0)n();else{var a=t.shift();this.repository.clone(a,Shopware.Context.api,{overwrites:{},cloneChildren:!1}).then((function(){o.cloneProgress+=1,o.duplicateVariant(e,t,n)}))}}}});var j=Shopware,U=j.Component,F=j.Mixin;U.register("blog-post-media-form",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_post_media_form %}\n \n {% block blog_post_detail_image_upload %}\n \n \n {% endblock %}\n\n {% block blog_post_detail_featured_img_alt %}\n \n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","acl"],mixins:[F.getByName("placeholder"),F.getByName("notification")],shortcuts:{"SYSTEMKEY+S":"onSave",ESCAPE:"onCancel"},props:{postId:{type:String,required:!1,default:null},post:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1}},provide:function(){return{openMediaSidebar:this.openMediaSidebar}},data:function(){return{isSaveSuccessful:!1}},metaInfo:function(){return{title:this.$createTitle(this.identifier)}},computed:{identifier:function(){return this.placeholder(this.post,"title")},postRepository:function(){return this.repositoryFactory.create("magefanblog_post")},mediaRepository:function(){return this.repositoryFactory.create("media")},mediaUploadTag:function(){return"blog-post-detail--".concat(this.post.id)},tooltipSave:function(){if(this.acl.can("blog_post.editor")){var e=this.$device.getSystemKey();return{message:"".concat(e," + S"),appearance:"light"}}return{showDelay:300,message:this.$tc("sw-privileges.tooltip.warning"),disabled:this.acl.can("blog_post.editor"),showOnDisabledElements:!0}},tooltipCancel:function(){return{message:"ESC",appearance:"light"}}},watch:{postId:function(){this.createdComponent()}},created:function(){this.createdComponent()},methods:{createdComponent:function(){this.postId&&this.loadEntityData()},loadEntityData:function(){var e=this;this.isLoading=!0,this.postRepository.get(this.postId).then((function(t){e.isLoading=!1,e.post=t}))},setMediaItem:function(e){var t=e.targetId;this.post.mediaId=t},setMediaFromSidebar:function(e){this.post.mediaId=e.id},onUnlinkLogo:function(){this.post.mediaId=null},openMediaSidebar:function(){this.$parent.$parent.$parent.$refs.mediaSidebarItem.openContent()},onDropMedia:function(e){this.setMediaItem({targetId:e.id})},onSave:function(){var e=this;this.acl.can("blog_post.editor")&&(this.isLoading=!0,this.postRepository.save(this.post).then((function(){e.isLoading=!1,e.isSaveSuccessful=!0,null!==e.postId?e.loadEntityData():e.$router.push({name:"blog.post.detail",params:{id:e.post.id}})})).catch((function(t){throw e.isLoading=!1,e.createNotificationError({message:e.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),t})))},onCancel:function(){this.$router.push({name:"blog.post.index"})}}});Shopware.Component.register("blog-post-short-content",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_post_short_content %}\n \n {% block blog_post_detail_short_content %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["acl"],props:{post:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1}}});var K=n("l0Wh"),Y=n("jRSL");n("E4Lo");Shopware.Module.register("blog-post",{type:"plugin",title:"blog-post.general.title",description:"blog-post.general.descriptionTextModule",color:"#ff68b4",icon:"regular-content",favicon:"icon-module-content.png",entity:"post",snippets:{"en-GB":K,"de-DE":Y},routes:{index:{component:"blog-post-list",path:"list",meta:{parentPath:"sw-content",privilege:"blog_post.viewer"}},create:{component:"blog-post-create",path:"create",meta:{privilege:"blog_post.creator",parentPath:"blog.post.index"}},detail:{component:"blog-post-detail",path:"detail/:id",meta:{parentPath:"blog.post.index",privilege:"blog_post.viewer"},props:{default:function(e){return{id:e.params.id}}}}},navigation:[{id:"blog.post.index",label:"blog-post.general.mainMenuItemList",color:"#ff68b4",path:"blog.post.index",icon:"regular-content",position:10,privilege:"blog_post.viewer",parent:"sw-content"}]});var z=Shopware,G=z.Component,q=z.Mixin,W=Shopware.Data.Criteria;G.register("blog-category-list",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_category_list %}\n \n {% block blog_category_list_smart_bar_header %}\n \n {% block blog_category_list_smart_bar_header_title %}\n \n {% block blog_category_list_smart_bar_header_title_text %}\n {{ $tc(\'blog-category.list.headerText\') }}\n {% endblock %}\n\n {% block blog_category_list_smart_bar_header_amount %}\n \n ({{ total }})\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n\n {% block blog_category_list_actions %}\n \n {% block blog_category_list_smart_bar_actions %}\n \n {{ $tc(\'blog-category.list.addCategoryButton\') }}\n \n {% endblock %}\n \n {% endblock %}\n\n \n {% block blog_category_list_content %}\n \n {% block blog_category_list_grid %}\n
\n {% block blog_category_list_grid_columns_actions %}\n\n \n \n {{ $tc(\'blog-category.list.editOption\') }}\n \n\n \n {{ $tc(\'blog-category.list.deleteOption\') }}\n \n \n {% endblock %}\n\n {% block blog_category_list_grid_action_modals %}\n \n\n {% block blog_category_list_delete_modal %}\n \n\n {% block blog_category_list_delete_modal_confirm_delete_text %}\n \n {{ $tc(\'blog-category.list.textDeleteConfirm\', 0, { name: `${item.title}` }) }}\n
\n {% endblock %}\n\n {% block blog_category_list_delete_modal_footer %}\n \n\n {% block blog_category_list_delete_modal_cancel %}\n \n {{ $tc(\'blog-category.list.buttonCancel\') }}\n \n {% endblock %}\n\n {% block blog_category_list_delete_modal_confirm %}\n \n {{ $tc(\'blog-category.list.buttonDelete\') }}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n \n \n \n {{ item.createdAt|date }}\n \n \n \n {{ item.updatedAt|date }}\n \n\n \n {{ item.createdAt|date }}\n \n \n \n {% endblock %}\n {# {% block blog_category_list_content_clone_modal %}\n
\n {% endblock %} #}\n
\n {% endblock %}\n \n \n{% endblock %}\n\n\n',inject:["repositoryFactory","acl"],mixins:[q.getByName("notification")],data:function(){return{categories:null,repository:{},isLoading:!0,cloning:!1,sortBy:"createdAt",sortDirection:"DESC",naturalSorting:!1,total:0,limit:10,page:1,showDeleteModal:!1,searchConfigEntity:"magefanblog_category"}},metaInfo:function(){return{title:this.$createTitle()}},computed:{categoryRepository:function(){return this.repositoryFactory.create("magefanblog_category")},categoryMenuRepository:function(){return this.repositoryFactory.create("category")},columns:function(){return[{property:"title",label:this.$t("blog-category.list.labelTitle"),routerLink:"blog.category.detail",inlineEdit:"string",allowResize:!0,primary:!0},{property:"identifier",dataIndex:"identifier",label:this.$t("blog-category.list.labelUrlKey"),inlineEdit:"string",allowResize:!0,sortable:!1},{property:"isActive",dataIndex:"is_active",label:this.$t("blog-category.list.labelActive"),inlineEdit:"boolean",allowResize:!0,type:"bool",align:"center",sortable:!1}]}},created:function(){this.getList()},beforeRouteLeave:function(e,t,n){this.$nextTick((function(){n()}))},methods:{onDelete:function(e){this.showDeleteModal=e},onCloseDeleteModal:function(){this.showDeleteModal=!1},onConfirmDelete:function(e){var t=this;return this.showDeleteModal=!1,this.categoryRepository.delete(e).then(this.categoryMenuRepository.delete(e).then((function(){t.getList()})))},getList:function(){var e=this;this.isLoading=!0;var t=new W(this.page,this.limit);t.addSorting(W.sort(this.sortBy,this.sortDirection,this.naturalSorting)),this.repository=this.repositoryFactory.create("magefanblog_category"),this.repository.search(t).then((function(t){e.categories=t,e.total=t.total,e.isLoading=!1}))},updateTotal:function(e){var t=e.total;this.total=t},onDuplicate:function(e){this.category=e,this.cloning=!0},onDuplicateFinish:function(e){var t=this;this.cloning=!1,this.category=null,this.$nextTick((function(){t.$router.push({name:"blog.category.detail",params:{id:e.id}})}))}}});n("33yf");function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var X=Shopware,Z=X.Component,J=X.Mixin,Q=X.Data.Criteria,ee=Shopware.Component.getComponentHelper().mapPropertyErrors;Z.register("blog-category-detail",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_category_detail %}\n \n\n {% block blog_category_detail_header %}\n \n {{ placeholder(category, \'title\', $tc(\'blog-category.detail.buttonAddCategory\')) }} \n \n {% endblock %}\n\n {% block blog_category_detail_actions %}\n \n\n {% block blog_category_detail_actions_abort %}\n \n {{ $tc(\'blog-category.detail.buttonCancel\') }}\n \n {% endblock %}\n\n {% block blog_category_detail_actions_save %}\n \n {{ $tc(\'blog-category.detail.buttonSave\') }}\n \n {% endblock %}\n\n \n {% endblock %}\n\n {% block blog_category_detail_content %}\n \n \n \n \n \n\n \n\n {% block blog_category_detail_base %}\n \n {% endblock %}\n {% block blog_category_display_setting %}\n \n {% endblock %}\n {% block blog_category_seo %}\n \n {% endblock %}\n \n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","acl"],mixins:[J.getByName("notification"),J.getByName("placeholder")],shortcuts:{"SYSTEMKEY+S":"onSave",ESCAPE:"onCancel"},props:{id:{type:String,required:!1,default:null}},data:function(){return{category:null,rootCategoryBlog:{},isLoading:!1,isSaveSuccessful:!1}},metaInfo:function(){return{title:this.$createTitle(this.identifier)}},computed:function(e){for(var t=1;t\n {% block blog_category_design_layout %}\n \n \n {{ type.label }}\n \n \n {% endblock %}\n\n {% block blog_category_design_layout_update_xml %}\n \n \n {% endblock %}\n \n{% endblock %}\n',mixins:[re.getByName("placeholder")],props:{category:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},data:function(){return{layoutTypes:[{value:"empty",label:this.$tc("blog-category.detail.emptyLayout")},{value:"column",label:this.$tc("blog-category.detail.oneColumnLayout")},{value:"columnswithleft",label:this.$tc("blog-category.detail.columnsWithLeftLayout")},{value:"columnswithright",label:this.$tc("blog-category.detail.columnsWithRightLayout")},{value:"3columns",label:this.$tc("blog-category.detail.3columnsLayout")}]}},computed:function(e){for(var t=1;t\n \n\n \n\n \n\n \n\n {% block blog_category_detail_base_info_field_description %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["acl"],mixins:[pe.getByName("placeholder")],props:{category:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},data:function(){return{categories:[{value:"media",label:this.$tc("blog-category.detail.mediaDisplayType")},{value:"text",label:this.$tc("blog-category.detail.textDisplayType")},{value:"select",label:this.$tc("blog-category.detail.selectDisplayType")},{value:"color",label:this.$tc("blog-category.detail.colorDisplayType")}]}},computed:function(e){for(var t=1;t\n {% block blog_category_display_setting_posts_soty_by %}\n \n \n {{ type.label }}\n \n \n {% endblock %}\n\n {% block blog_category_display_setting_posts_list_template %}\n \n \n {{ option.label }}\n \n \n {% endblock %}\n\n {% block blog_category_detail_posts_per_page %}\n \n {% endblock %}\n \n{% endblock %}\n',mixins:[he.getByName("placeholder")],props:{category:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},data:function(){return{displayTypes:[{value:"default",label:this.$tc("blog-category.detail.defaultTemplate")}],sortByTypes:[{value:"createdAt",label:this.$tc("blog-category.detail.defaultSort")},{value:"position",label:this.$tc("blog-category.detail.positionSort")},{value:"title",label:this.$tc("blog-category.detail.titleSort")}]}},created:function(){this.category.postsListTemplate||(this.category.postsListTemplate="default"),this.category.postsSortBy||(this.category.postsSortBy="createdAt")}});var be=Shopware,me=be.Component,ye=be.Mixin;me.getComponentHelper().mapPropertyErrors;me.register("blog-category-seo",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_category_seo %}\n \n\n {% block blog_category_seo_identifier %}\n \n {% endblock %}\n\n {% block blog_category_seo_meta_title %}\n \n {% endblock %}\n\n {% block blog_category_seo_meta_keywords %}\n \n {% endblock %}\n\n {% block blog_category_seo_meta_description %}\n \n {% endblock %}\n \n{% endblock %}\n',mixins:[ye.getByName("placeholder")],props:{category:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}}});var _e=n("m0Ej"),ve=n("iZQH");n("MK3V");Shopware.Module.register("blog-category",{type:"plugin",title:"blog-category.general.title",description:"blog-post.general.descriptionTextModule",color:"#ff68b4",icon:"regular-content",favicon:"icon-module-content.png",entity:"tags",snippets:{"en-GB":_e,"de-DE":ve},routes:{index:{component:"blog-category-list",path:"list",meta:{parentPath:"sw-content",privilege:"blog_category.viewer"}},create:{component:"blog-category-detail",path:"create",meta:{parentPath:"blog.category.index",privilege:"blog_category.creator"}},detail:{component:"blog-category-detail",path:"detail/:id",meta:{parentPath:"blog.category.index",privilege:"blog_category.viewer"},props:{default:function(e){return{id:e.params.id}}}}},navigation:[{id:"blog.category.index",label:"blog-category.general.mainMenuItemList",color:"#ff68b4",path:"blog.category.index",icon:"regular-content",position:12,privilege:"blog_category.viewer",parent:"sw-content"}]});var we=Shopware,Se=we.Component,ke=we.Mixin,Te=Shopware.Data.Criteria;Se.register("blog-tag-list",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n{% block blog_tag_list %}\n \n {% block blog_tag_list_smart_bar_header %}\n \n {% block blog_tag_list_smart_bar_header_title %}\n \n {% block blog_tag_list_smart_bar_header_title_text %}\n {{ $tc(\'blog-tag.list.mainHeaderText\') }}\n {% endblock %}\n\n {% block blog_tag_list_smart_bar_header_amount %}\n \n ({{ total }})\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n\n {% block blog_tag_list_actions %}\n \n {% block blog_tag_list_smart_bar_actions %}\n \n {{ $tc(\'blog-tag.list.addTagButton\') }}\n \n {% endblock %}\n \n {% endblock %}\n\n \n {% block blog_tag_list_content %}\n \n {% block blog_tag_list_grid %}\n \n {# \n {% block blog_tag_list_grid_columns_actions_duplicate %}\n \n {{ $tc(\'blog-tag.list.buttonDuplicate\') }}\n \n {% endblock %}\n #}\n \n \n \n \n {% endblock %}\n {# {% block blog_tag_list_content_clone_modal %}\n \n {% endblock %} #}\n
\n {% endblock %}\n \n {# {% block sw_data_grid_slot_pagination %}\n \n {% endblock %} #}\n \n{% endblock %}\n\n\n',inject:["repositoryFactory","acl"],mixins:[ke.getByName("notification")],data:function(){return{tags:null,repository:{},isLoading:!0,cloning:!1,sortBy:"createdAt",sortDirection:"DESC",naturalSorting:!1,total:0,limit:10,page:1,searchConfigEntity:"magefanblog_tag"}},metaInfo:function(){return{title:this.$createTitle()}},computed:{tagRepository:function(){return this.repositoryFactory.create("magefanblog_tag")},columns:function(){return[{property:"title",label:this.$t("blog-tag.list.labelTitle"),routerLink:"blog.tag.detail",inlineEdit:"string",allowResize:!0,primary:!0},{property:"identifier",dataIndex:"identifier",label:this.$t("blog-tag.list.labelUrlKey"),inlineEdit:"string",allowResize:!0,sortable:!1},{property:"isActive",dataIndex:"is_active",label:this.$t("blog-tag.list.labelActive"),inlineEdit:"boolean",allowResize:!0,type:"bool",align:"center",sortable:!1}]}},created:function(){this.getList()},beforeRouteLeave:function(e,t,n){this.$nextTick((function(){n()}))},methods:{getList:function(){var e=this;this.isLoading=!0;var t=new Te(this.page,this.limit);t.addSorting(Te.sort(this.sortBy,this.sortDirection,this.naturalSorting)),this.repository=this.repositoryFactory.create("magefanblog_tag"),this.repository.search(t).then((function(t){e.tags=t,e.total=t.total,e.isLoading=!1}))},updateTotal:function(e){var t=e.total;this.total=t},onDuplicate:function(e){this.tag=e,this.cloning=!0},onDuplicateFinish:function(e){var t=this;this.cloning=!1,this.tag=null,this.$nextTick((function(){t.$router.push({name:"blog.tag.detail",params:{tagId:e.id}})}))}}});var Ce=Shopware,xe=Ce.Component,Ee=Ce.Mixin,Pe=Shopware.Data.Criteria;xe.register("blog-tag-detail",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_tag_detail %}\n \n {% block blog_tag_detail_smart_bar_header %}\n \n\n {% block blog_tag_detail_smart_bar_header_title %}\n {{ placeholder(tag, \'title\', $tc(\'blog-tag.detail.textHeadline\')) }} \n {% endblock %}\n\n \n {% endblock %}\n\n {% block blog_tag_detail_smart_bar_actions %}\n \n {% block blog_tag_detail_smart_bar_actions_cancel %}\n \n {{ $tc(\'blog-tag.detail.buttonCancel\') }}\n \n {% endblock %}\n\n {% block blog_tag_detail_smart_bar_actions_save %}\n \n {{ $tc(\'blog-tag.detail.buttonSave\') }}\n \n {% endblock %}\n \n {% endblock %}\n\n {% block blog_tag_detail_content %}\n \n \n \n \n \n \n\n {% block blog_tag_detail_base %}\n \n {% endblock %}\n\n {% block blog_tag_display_setting %}\n \n {% endblock %}\n\n {% block blog_tag_seo %}\n \n {% endblock %}\n
\n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","acl"],mixins:[Ee.getByName("notification"),Ee.getByName("placeholder")],shortcuts:{"SYSTEMKEY+S":{active:function(){return this.acl.can("blog_tag.editor")},method:"onSave"},ESCAPE:"onCancel"},props:{tagId:{type:String,default:null}},data:function(){return{tag:null,isLoading:!1,isSaveSuccessful:!1,customFieldSets:null}},metaInfo:function(){return{title:this.$createTitle(this.identifier)}},computed:{identifier:function(){return this.placeholder(this.tag,"title")},tagRepository:function(){return this.repositoryFactory.create("magefanblog_tag")},tooltipSave:function(){if(!this.acl.can("blog_tag.editor"))return{message:this.$tc("blog-tag.tooltip.warning"),disabled:this.acl.can("blog_tag.editor"),showOnDisabledElements:!0};var e=this.$device.getSystemKey();return{message:"".concat(e," + S"),appearance:"light"}},tooltipCancel:function(){return{message:"ESC",appearance:"light"}},defaultCriteria:function(){return new Pe(this.page,this.limit)}},watch:{tagId:function(){this.loadEntityData()}},created:function(){this.createdComponent()},methods:{createdComponent:function(){this.loadEntityData()},loadEntityData:function(){var e=this;this.isLoading=!0,this.tagRepository.get(this.$attrs.id,Shopware.Context.api,this.defaultCriteria).then((function(t){e.tag=t,e.isLoading=!1})).catch((function(){e.isLoading=!1}))},saveFinish:function(){this.isSaveSuccessful=!1},saveTag:function(){var e=this;return this.isLoading=!0,new Promise((function(t){var n=e.tag.identifier;e.tag.title&&(n=void 0===n||e.isUrlValid(n)?d()(e.tag.title,"-"):d()(n,"-")),e.tag.identifier=n,e.tagRepository.save(e.tag).then((function(){e.isLoading=!1,e.isSaveSuccessful=!0,t("success")})).catch((function(t){throw e.isLoading=!1,e.isSaveSuccessful=!1,e.createNotificationError({message:e.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),t}))}))},onSave:function(){return this.saveTag()},onCancel:function(){this.$router.push({name:"blog.tag.index"})},isUrlValid:function(e){return/^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/.test(e)},prepareIdentifier:function(e){return e.replace(/ +/g,"-").toLowerCase()}}});Shopware.Component.extend("blog-tag-create","blog-tag-detail",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_tag_detail_content_option_list %}\n \n \n{% endblock %}\n',data:function(){return{newId:null}},methods:{createdComponent:function(){this.tag=this.tagRepository.create(),this.newId=this.tag.id,this.isLoading=!1},saveFinish:function(){this.isSaveSuccessful=!1,this.$router.push({name:"blog.tag.detail",params:{id:this.newId}})},onSave:function(){this.$super("onSave")}}});function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Oe=Shopware,Ie=Oe.Component,De=Oe.Mixin,Me=Ie.getComponentHelper().mapPropertyErrors;Ie.register("blog-tag-detail-base",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_tag_detail_base %}\n \n {% block blog_tag_detail_is_active %}\n \n {% endblock %}\n\n {% block blog_tag_detail_title %}\n \n {% endblock %}\n\n\n {% block blog_tag_detail_content %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["acl"],mixins:[De.getByName("placeholder")],props:{tag:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},computed:function(e){for(var t=1;t\n {% block blog_tag_detail_display_type %}\n \n \n {{ option.label }}\n \n \n {% endblock %}\n\n {% block blog_tag_detail_posts_per_page %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["acl"],mixins:[Ne.getByName("placeholder")],props:{tag:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},data:function(){return{displayTypes:[{value:"default",label:this.$tc("blog-tag.detail.defaultTemplate")}]}},created:function(){this.tag.postsListTemplate||(this.tag.postsListTemplate="default")}});var Be=Shopware,je=Be.Component,Ue=Be.Mixin;je.getComponentHelper().mapPropertyErrors;je.register("blog-tag-seo",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_tag_seo %}\n \n {% block blog_tag_seo_identifier %}\n \n {% endblock %}\n\n {% block blog_tag_seo_meta_title %}\n \n {% endblock %}\n\n {% block blog_tag_seo_meta_keywords %}\n \n {% endblock %}\n\n {% block blog_tag_seo_meta_description %}\n \n {% endblock %}\n\n {% block blog_tag_seo_display_type %}\n \n \n {{ robot.label }}\n \n \n {% endblock %}\n \n{% endblock %}\n',inject:["acl"],mixins:[Ue.getByName("placeholder")],props:{tag:{type:Object,required:!0,default:function(){return{}}},isLoading:{type:Boolean,default:!1},allowEdit:{type:Boolean,required:!1,default:!0}},data:function(){return{metaRobots:[{value:"config",label:this.$tc("blog-tag.detail.configRobots")},{value:"INDEX, FOLLOW",label:this.$tc("blog-tag.detail.indexFollow")},{value:"NOINDEX, FOLLOW",label:this.$tc("blog-tag.detail.noindexFollow")},{value:"INDEX, NOFOLLOW",label:this.$tc("blog-tag.detail.indexNofollow")},{value:"NOINDEX, NOFOLLOW",label:this.$tc("blog-tag.detail.noindexNofollow")}]}},created:function(){this.tag.metaRobots||(this.tag.metaRobots="config")}});function Fe(e,t,n,o,a,r,i){try{var l=e[r](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,a)}var Ke=Shopware.Component,Ye=Shopware.Data.Criteria;Ke.register("blog-tag-clone-modal",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block sw_product_clone_modal %}\n\n {% block sw_product_clone_modal_description %}\n \n {{ $tc(\'sw-product.general.cloneNotice\') }}\n
\n {% endblock %}\n\n {% block sw_product_clone_modal_progress_bar %}\n \n {% endblock %}\n\n {% block sw_product_clone_modal_progress_bar_description %}\n \n {{ cloneProgress }} {{ $tc(\'sw-product.variations.progressTypeOf\') }} {{ cloneMaxProgress }} {{ $tc(\'sw-product.general.cloneSuffix\') }}\n
\n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","numberRangeService"],props:{tag:{type:Object,required:!0}},data:function(){return{cloningVariants:!1,cloneMaxProgress:0,cloneProgress:0}},computed:{progressInPercentage:function(){return 100/this.cloneMaxProgress*this.cloneProgress},repository:function(){return this.repositoryFactory.create("magefanblog_tag")}},created:function(){this.createdComponent()},methods:{createdComponent:function(){this.duplicate()},duplicate:function(){this.numberRangeService.reserve("tag").then(this.cloneParent).then(this.verifyVariants)},cloneParent:function(e){var t,n=this;return(t=regeneratorRuntime.mark((function e(){var t,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={cloneChildren:!1,overwrites:{title:"".concat(n.tag.title," ").concat(n.$tc("global.default.copy")),active:!1}},e.next=3,n.repository.save(n.tag);case 3:return e.next=5,n.repository.clone(n.tag.id,Shopware.Context.api,t);case 5:return o=e.sent,e.abrupt("return",{id:o.id});case 7:case"end":return e.stop()}}),e)})),function(){var e=this,n=arguments;return new Promise((function(o,a){var r=t.apply(e,n);function i(e){Fe(r,o,a,i,l,"next",e)}function l(e){Fe(r,o,a,i,l,"throw",e)}i(void 0)}))})()},verifyVariants:function(e){var t=this;this.getChildrenIds().then((function(n){n.length<=0?t.$emit("clone-finish",{id:e.id}):(t.cloningVariants=!0,t.cloneProgress=1,t.cloneMaxProgress=n.length,t.duplicateVariant(e,n,(function(){t.cloningVariants=!1,t.$emit("clone-finish",{id:e.id})})))}))},getChildrenIds:function(){var e=new Ye(1,null);return this.repository.searchIds(e).then((function(e){return e.data}))},duplicateVariant:function(e,t,n){var o=this;if(t.length<=0)n();else{var a=t.shift();this.repository.clone(a,Shopware.Context.api,{overwrites:{},cloneChildren:!1}).then((function(){o.cloneProgress+=1,o.duplicateVariant(e,t,n)}))}}}});var ze=n("TQYO"),Ge=n("ozKe");n("oFtQ");Shopware.Module.register("blog-tag",{type:"plugin",title:"blog-tag.general.title",description:"blog-post.general.descriptionTextModule",color:"#ff68b4",icon:"regular-content",favicon:"icon-module-content.png",entity:"tags",snippets:{"en-GB":ze,"de-DE":Ge},routes:{index:{component:"blog-tag-list",path:"list",meta:{parentPath:"sw-content",privilege:"blog_tag.viewer"}},create:{component:"blog-tag-create",path:"create",meta:{parentPath:"blog.tag.index",privilege:"blog_tag.creator"}},detail:{component:"blog-tag-detail",path:"detail/:id",meta:{parentPath:"blog.tag.index",privilege:"blog_tag.viewer"},props:{default:function(e){return{id:e.params.id}}}}},navigation:[{id:"blog.tag.index",label:"blog-tag.general.mainMenuItemList",color:"#ff68b4",path:"blog.tag.index",icon:"regular-content",position:13,privilege:"blog_tag.viewer",parent:"sw-content"}]});n("Y/sd");function qe(e,t,n,o,a,r,i){try{var l=e[r](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,a)}var We=Shopware,He=We.Component,Ve=We.Mixin,Xe=Shopware.Data.Criteria;He.register("blog-comment-list",{template:'{#\n* Copyright © Magefan (support@magefan.com). All rights reserved.\n* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).\n#}\n\n{% block blog_comment_list %}\n \n {% block mf_blog_comment_list_search_bar %}\n \n \n \n {% endblock %}\n\n {% block mf_blog_comment_list_smart_bar_header %}\n \n {% block mf_blog_comment_list_smart_bar_header_title %}\n \n {% block mf_blog_comment_list_smart_bar_header_title_text %}\n {{ $tc(\'blog-comment.list.title\') }}\n {% endblock %}\n\n {% block mf_blog_comment_list_smart_bar_header_amount %}\n ({{ total }}) \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n\n \n {% block mf_blog_comment_list_content %}\n \n {% endblock %}\n \n \n{% endblock %}\n',inject:["repositoryFactory","acl","filterFactory"],mixins:[Ve.getByName("notification"),Ve.getByName("listing"),Ve.getByName("placeholder")],data:function(){return{comments:null,sortBy:"createdAt",sortDirection:"DESC",isLoading:!1,total:0,comment:null,filterCriteria:[],defaultFilters:["status-filter"],storeKey:"grid.filter.comment",activeFilterNumber:0,searchConfigEntity:"comment"}},metaInfo:function(){return{title:this.$createTitle()}},computed:{commentRepository:function(){return this.repositoryFactory.create("magefanblog_comment")},commentColumns:function(){return this.getCommentColumns()},commentCriteria:function(){var e=new Xe(this.page,this.limit);return e.setTerm(this.term),e.addSorting(Xe.sort(this.sortBy,this.sortDirection,this.naturalSorting)),e.addAssociation("post"),this.filterCriteria.forEach((function(t){e.addFilter(t)})),e},listFilters:function(){return this.filterFactory.create("comment",{"status-filter":{property:"status",label:this.$tc("mf-comment.filters.statusFilter.label"),placeholder:this.$tc("mf-comment.filters.statusFilter.placeholder")}})}},watch:{commentCriteria:{handler:function(){this.getList()},deep:!0}},beforeRouteLeave:function(e,t,n){this.$nextTick((function(){n()}))},methods:{getList:function(){var e,t=this;return(e=regeneratorRuntime.mark((function e(){var n,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.isLoading=!0,e.next=3,Shopware.Service("filterService").mergeWithStoredFilters(t.storeKey,t.commentCriteria);case 3:return n=e.sent,e.next=6,t.addQueryScores(t.term,n);case 6:if(n=e.sent,t.activeFilterNumber=n.filters.length-1,t.entitySearchable){e.next=12;break}return t.isLoading=!1,t.total=0,e.abrupt("return");case 12:return t.freshSearchTerm&&n.resetSorting(),e.prev=13,e.next=16,Promise.all([t.commentRepository.search(n)]);case 16:o=e.sent,a=o[0],t.total=a.total,t.comments=a,t.isLoading=!1,t.selection={},e.next=27;break;case 24:e.prev=24,e.t0=e.catch(13),t.isLoading=!1;case 27:case"end":return e.stop()}}),e,null,[[13,24]])})),function(){var t=this,n=arguments;return new Promise((function(o,a){var r=e.apply(t,n);function i(e){qe(r,o,a,i,l,"next",e)}function l(e){qe(r,o,a,i,l,"throw",e)}i(void 0)}))})()},onInlineEditSave:function(e,t){var n=this,o=t.text||this.placeholder(t,"text");return e.then((function(){n.createNotificationSuccess({message:n.$tc("sw-product.list.messageSaveSuccess",0,{text:o})})})).catch((function(){n.getList(),n.createNotificationError({message:n.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")})}))},onInlineEditCancel:function(e){e.discardChanges()},updateTotal:function(e){var t=e.total;this.total=t},updateCriteria:function(e){this.page=1,this.filterCriteria=e},getCommentColumns:function(){return[{property:"text",label:this.$t("blog-comment.list.labelText"),routerLink:"blog.comment.detail",inlineEdit:"string",allowResize:!0,primary:!0},{property:"authorNickname",label:this.$t("blog-comment.list.labelNickName"),align:"right",allowResize:!0},{property:"post.title",label:this.$t("blog-comment.list.labelPost"),allowResize:!0},{property:"status",label:this.$t("blog-comment.list.labelStatus"),align:"center",allowResize:!0},{property:"createdAt",label:this.$t("blog-comment.list.labelPublished"),align:"right",allowResize:!0},{property:"updatedAt",label:this.$t("blog-comment.list.labelModified"),align:"right",allowResize:!0}]},onColumnSort:function(e){this.onSortColumn(e)}}});var Ze=n("B5uu");function Je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Qe(e){for(var t=1;t