Search code examples
sulu

Sulu smart content filter feature (Drupal's exposed filter like)


I'm working on a sulu project (I think it is currently on 1.3) and using its smart content feature to display teaser lists. What I would like to achieve now is to make these lists user filterable [edit: website user, not content manager] e.g. by tag, a bit like the Drupal Views' exposed filter feature. Did I miss something or does it simply not exist in the Sulu world? I don't need any advanced search backend as in the SuluSearchBundle, a way for the user to edit the filtered tags would be completely sufficient for the moment.

Thanks in advance and best regards

Sören


Solution

  • That's a built-in feature in Sulu, the content manager can decide how to filter the smart content, based on e.g. tags & categories. When you click on the configuration button for the smart content you see a overlay like this: enter image description here

    On the autocomplete for "Filter by tags" you can enter by which tag the smart content should be filtered.

    UPDATE 2017-06-14:

    You can also let the user filter for tags, that's what the tags_parameter parameter in the template configuration is for:

            <property name="smartcontent" type="smart_content">
            <meta>
                <title lang="de">Smart-Content</title>
                <title lang="en">Smart-Content</title>
            </meta>
    
            <params>
                <param name="tags_parameter" value="tags"/>
                <param name="properties" type="collection">
                    <param name="title" value="title"/>
                    <param name="article" value="article"/>
                    <param name="ext_title" value="excerpt.title"/>
                    <param name="ext_tags" value="excerpt.tags"/>
                    <param name="ext_images" value="excerpt.images"/>
                </param>
            </params>
        </property>
    

    Now you can append something like ?tags=tag1,tag2to the URL and the content will be further filtered.