Skip to content

Commit

Permalink
XML feeds: fix converting html (wysiwyg) texts to plain text
Browse files Browse the repository at this point in the history
- ensure there is a space between words after stripping HTML tags
  • Loading branch information
vitek-rostislav committed Jan 3, 2024
1 parent 5edc128 commit 4089cfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Model/PersooArticleFeedItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shopsys\ArticleFeed\PersooBundle\Model;

use Shopsys\FrameworkBundle\Component\String\TransformString;
use Shopsys\FrameworkBundle\Model\Feed\FeedItemImageHelper;

class PersooArticleFeedItemFactory
Expand All @@ -19,7 +20,7 @@ public function create(array $articleData, int $itemNumber): PersooArticleFeedIt
$itemNumber,
$articleData['name'],
$articleData['url'],
$articleData['text'],
TransformString::convertHtmlToPlainText($articleData['text']),
$this->getImageUrl($articleData),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/feed.xml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>{{ item.title }}</title>
<link>{{ item.link }}</link>
{% if item.description is not null %}
<description><![CDATA[{{ item.description|striptags|replace({"\n": ' '})|trim }}]]></description>
<description><![CDATA[{{ item.description }}]]></description>
{% endif %}
{% if item.imageLink is not null %}
<imageLink>{{ item.imageLink }}</imageLink>
Expand Down

0 comments on commit 4089cfc

Please sign in to comment.