Skip to content

Conversation

draconivis
Copy link
Member

@draconivis draconivis commented Apr 3, 2025

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets -
Related issues/PRs -
License MIT
Documentation PR -

What's in this PR?

adds handling of requestParameters in SelectionFieldFilterType.

Why?

This enables the rootKey to be passed to the CategoryController for example, so only subcategories of the provided category key are shown in the selection

Example Usage

<!-- contacts.xml -->
<property
    name="categoryId"
    visibility="never"
    translation="sulu_category.categories"
>
    <field-name>id</field-name>
    <entity-name>Sulu\Bundle\CategoryBundle\Entity\Category</entity-name>

    <joins>
        <join>
            <entity-name>Sulu\Bundle\CategoryBundle\Entity\Category</entity-name>
            <field-name>%sulu.model.contact.class%.categories</field-name>
        </join>
    </joins>

    <filter type="selection">
        <params>
            <param name="displayProperty" value="name" />
            <param name="resourceKey" value="categories" />
            <!-- add the requestParameters and the rootKey here -->
            <param name="requestParameters" type="collection">
                <param name="rootKey" value="{the key of the category}" />
            </param>
        </params>
    </filter>
</property>

@draconivis draconivis self-assigned this Apr 3, 2025
@wachterjohannes wachterjohannes merged commit 8c480f0 into sulu:2.6 Apr 8, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants