XML Extensions with conditions
Hi guys!
I would like to apply an XML Extension only for a particular path.
Let's say I want to remote the notification tab in the administration panel for each folders inside : /default-domain/worspaces/myWorkspace/aSpecialFolder/
So I'm using this Extension :
<extension target="org.nuxeo.ecm.platform.actions.ActionService" point="actions">
<action id="TAB_MANAGE_SUBSCRIPTIONS" enabled="false"/>
</extension>
But it removes the subscription tab for any folder in my nuxeo instance. How can I use it only on a particular path ? ( a “path start with” condition would be perfect )
EDIT :
as guillaume suggested, I've tried to add a filter node in my action so I can enable it according to the current document path like this :
<extension target="org.nuxeo.ecm.platform.actions.ActionService"
point="actions">
<action id="TAB_MANAGE_SUBSCRIPTIONS" >
<filter id="TAB_MANAGE_SUBSCRIPTIONS">
<rule grant="true">
<condition>#{!currentDocument.getPathAsString().startsWith("/default-domain/worspaces/myWorkspace/aSpecialFolder/")}</condition>
</rule>
</filter>
</action>
</extension>
But it doesn't seem to work, I'll keep testing but just in case, can you see where I did wrong ?
Please read about action and filters on User Actions (Links, Buttons, Icons, Tabs). Check the Managing Filters to Control an Action Visibility section.
Ok it works now with :
<extension target="org.nuxeo.ecm.platform.actions.ActionService"
point="actions">
<action id="TAB_MANAGE_SUBSCRIPTIONS" >
<filter id="TAB_MANAGE_SUBSCRIPTIONS">
<rule grant="false">
<condition>#{currentDocument.getPathAsString().startsWith("/default-domain/worspaces/myWorkspace/aSpecialFolder/")}</condition>
</rule>
</filter>
</action>
</extension>
I guess there was no sens to enable it only outside of a folder since its enabled by default so I Disabled it inside of the target folder and it works fine !
thanks for your help!