I'm trying to implement a Filter that adds a css class into the div of ExperienceFragment. Everything works fine, until we change the ExperienceFragment (single one) via a cq:dialog. The IncludeOptions do not pass the css class.
(Sling filter activated properly and added the "footer" class on page refresh).
After editing single XF, like,
"footer" class is not applied.
I'm using sling sling.filter.scope = "COMPONENT" and sling.filter.resourceTypes pointing to "cq/experience-fragments/editor/components/experiencefragment".
Is there any other way to achieve that via a SlingFilter?
thanks for your time and the sample code but are you sure that the above java filter worked for an editable experience fragment for example in structure mode on a template? I agree with you that is working but not for a single edition of an experience fragment (it works after page refresh though).
The reproduction steps are: 1. Having a template with an added experience fragment in structure.
2. Opening the dialog by clicking the wrench on the experience fragment
3. picking the same path or trying another one
4. submitting the changes
4. css is not added without page refresh
I'm sorry that i'm explaining this once more to you but I just wanted to be sure that you understood my case in 100%
Maybe it's just something screwed on my side. Atleast it's not working for me so maybe it's smth with my AEM? I'm using 6.5. Maybe i'll try with element selector or JS rules but I wanted really to make working via the filter class.
If the options.forceSameContext(true) is set above .getCssClassNames(), it does nothing. If I set it under that method all experience fragments on the page are not editable and I can't pick a new path for the XF via a cq:dialog. (it's not clickable). Service ranking is set to 201 to force it to be above the WCMComponentFilter.
Also, setting the forceSameContext after the getCssClassNames() do not applies the experiencefragment class into div and overrides it with root as on the screenshot:
Sorry for the raw code that I pasted, but when I highlighted it with Java it does not look very nice.