Hello I'm in the process of creating some custom imaging variations for paragraphs we have developed. I'm using the imaging module, and so I have to create css selectors that will match some css rule.
I find this rather hard. The system that creates the css selector is build in such a way that it is completely closed, and it is not easy to find out what css selector will be created for an image in a certain place. What I tend to do is create a model class for the paragraph, just to be able to set a breakpoint on an empty overridden method getImageVariationName(). This is obviously not the way to go, but what else is there? The method getImageVariationName uses the util class CssSelectorBuilder, but that class is not constructing the whole selector, so it is no use to use it independently, if only to test what the selector will be. The cssSelector value created in getImageVariationName is not separated in it's own method (so jou can access it from the template or reach it from a subclass), it doesn't do any logging and sets no fields on the model (that you could read). So the value is created and is gone again. That makes it hard to know what selector is created for a specific image. Of course I can just not use the ImageModel class and recreate the entire hierarchy just to fix this, but I wouldn't like that. The next thing is how the selector rules work. It seems to me that it is actually matching the rule with the least specific match, or rather the first rule it finds that matches it in the slightest. For instance: when you have a css selector for an image that looks like this: "#home #main .coverslide .teaser .coverslide" And there is a variation called teaser (as there indeed is), with a pattern rule like ".teaser" Then that variation is honored, even if there are much more specific patterns. The reason this rule 'wins' is simply that it comes first in the list of rules. That makes it very hard to work with those rules, and it is contra-intuitive to me. Can anybody give me some hints as to what the idea behind the design is and how i should deal with these problems. I know i can build my own classes for Rules and so on, but we try to use the stk stuff as much as possible, and i don't want to break that. regards, Ernst -- Ernst Bunders Ontwikkelaar VPRO ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
