Closed kleffsche closed 1 year ago
Thanks for reporting, the news_selection will be fixed in the next release with the Sulu 2.5 and Symfony Update again.
I also added a twig extension so that the news can be easily loaded in a frontend.
Call the news from the list of "news_selection" with sulu_resolve_news(id)
.
That works very well, I just have to figure out how to get the items from the news, or better, from the resolved news (sulu_resolve_news
), but I guess this twig extension makes it a lot easier.
A small example, how I get the data in a twig view:
{% for newsItem in content.news %}
{% set news = sulu_resolve_news(newsItem.id) %}
{% if news.header.id|default %}
{% set image = sulu_resolve_media(news.header.id, app.request.locale) %}
<img src="{{ image.thumbnails['2560x550'] }}">
{% endif %}
{% endfor %}
I think that's the right way to do it with data from a news_selection
, isn't it?
Thank you, again, for your help and this very useful bundle. :+1
P.S. a small code example for a twig view in the README docs would be nice. Just saying.
So I managed to install this bundle with Sulu 2.5 and Symfony 6 but when I try to select news (type
news_selection
)on a page, for example in homepage.xml like this:the page won't load anymore.
When I try to load news in a block:
the page loads but I got this error: