-
Improvement
-
Resolution: Unresolved
-
Major
-
4.3.14
-
None
-
None
-
1 - Middle term
-
2 - Normal
Currently it is not possible to disable contents extension from Static filters definition, there is no tag dedicated for that.
Workaround
Create a new Java Class (DisableContentExtension) extending org.ametys.plugins.newsletter.auto.StaticAutomaticNewsletter with the following Java code :
package org.ametys.plugins.cannes.newsletter; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.ametys.cms.repository.ContentTypeExpression; import org.ametys.plugins.repository.query.expression.Expression; import org.ametys.plugins.repository.query.expression.Expression.Operator; import org.ametys.plugins.repository.query.expression.OrExpression; public class DisableContentExtension extends org.ametys.web.filter.StaticWebContentFilter { protected Expression getContentTypesExpression() { Expression expr = null; List<Expression> cTypesExpr = new ArrayList<>(); if (_contentTypes != null && _contentTypes.size() > 0) { for (String contentType : _contentTypes) { // Filter on content type and all its children Set<String> cTypeAndSubTypes = new LinkedHashSet<>(); cTypeAndSubTypes.add(contentType); // cTypeAndSubTypes.addAll(_contentTypeEP.getSubTypes(contentType)); cTypesExpr.add(new ContentTypeExpression(Operator.EQ, cTypeAndSubTypes.toArray(new String[cTypeAndSubTypes.size()]))); } expr = new OrExpression(cTypesExpr.toArray(new Expression[cTypesExpr.size()])); } return expr; } }
And instead of calling "org.ametys.plugins.newsletter.auto.StaticAutomaticNewsletter" in static filter definition, you call the new defined Class : org.ametys.plugins.cannes.newsletter.DisableContentExtension