Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmartContent allow Filter Params #47

Open
manuxi opened this issue Jun 18, 2023 · 3 comments
Open

SmartContent allow Filter Params #47

manuxi opened this issue Jun 18, 2023 · 3 comments
Labels
feature feature

Comments

@manuxi
Copy link

manuxi commented Jun 18, 2023

I'd like to filter the news by tag but it doesn't work this way:

<property name="news" type="smart_content">
<meta>
  <title lang="en">Latest FAQ</title>
</meta>

<params>
  <param name="provider" value="news"/>
  <param name="max_per_page" value="5"/>
  <param name="page_parameter" value="p"/>
  <param name="tags_parameter" value="faq"/>
</params>
</property>

Is this possible at all?

@TheCadien
Copy link
Owner

Currently we don't have any "resolveFilter" in the SmartContent component yet these would have to be added in the "NewsDataProvider.php", like for example in the SnippetSmartContent component

@TheCadien TheCadien added the feature feature label Jun 18, 2023
@TheCadien TheCadien changed the title Filter by Tag SmartContent alow Filter Params Jun 18, 2023
@manuxi
Copy link
Author

manuxi commented Jun 18, 2023

Welll... I played around a bit, seems to work with

<params>
    <param name="provider" value="news"/>
    <param name="max_per_page" value="5"/>
    <param name="page_parameter" value="p"/>
    <param name="properties" type="collection">
        <param name="tag" value="FAQ"/>
    </param>
</params>

Would be great to have that manageable by the client, but i'm happy if it works that way.
Thank you for that bundle!

@manuxi manuxi changed the title SmartContent alow Filter Params SmartContent allow Filter Params Jun 18, 2023
@manuxi
Copy link
Author

manuxi commented Oct 26, 2023

I've digged deeper into that filter issue. To get it to work I've added several methods in my repository class which are responsible for ordering and filtering for types (I made this to filter nearly every custom field, e.g. date comparison), tags and categories. See https://github.com/manuxi/SuluEventBundle/blob/afb1fab9f23f7b5a10e2ccd0c1987d31a1eac8fa/src/Repository/EventRepository.php#L221 - I think this would fit in your repository class with few adjustments...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature
Projects
None yet
Development

No branches or pull requests

2 participants