-
-
Notifications
You must be signed in to change notification settings - Fork 213
Add hook to FrontendTemplate->getCustomSection() #4944
Comments
Anything else you need besides adding class attributes? |
Hi Leo, thanks for responding. No, that's it :) |
I'm still trying to figure out whether we need a hook or there is a way to add the CSS classes in the function call (which would be a lot easier than setting up a hook class). Can you please outline the HTML code you want Contao to create to help me decide? |
I want to apply a class selector directly to the custom section HTML without JS. This would greatly simplify my job in moving to, for example, the twitter bootstrap responsive framework by following their conventions of using classes across layout elements (e.g. .container and .row class selectors) Contao lets us alter the fe_page template for all other elements except for those custom sections. If there were a custom section template, or at the very least the raw html for them existed in the fe_page template, that would solve the problem quickly. Since we can include our own frameworks, we should be able to use them fully, rather than nearly rewrite them. :) Consider the header as the example:
and to correct the limitation, change
to loop through while using the same
elements as you would for any other section. I can see why this becomes a lot of work for a small bit of change, but it becomes an Achilles heel if I choose to make use of the "use your own css framework" feature that I'm very excited about for Contao 3 :) You can see why the hook seemed easier in this case, or a template for custom sections... Your thoughts? |
Two ideas: either allow to pass a mapper array with CSS class names <?php echo $this->getCustomSections('before', array('mycustomsection'=>'mycustomclassname')); ?> or – the better one I think – create a template for custom sections (this was your idea, of course). |
The first idea could be added as a "bug fix" to Contao 2.11. The second one would have to be added to Contao 3. |
What do you prefer? |
Hi Leo, So sorry I dropped the ball here. I think I'd favor the second idea you mention. Seems like the best solution overall. |
Note to myself: also check #2885. |
I just noticed that if there are custom sections, you can access |
I'm finding during template buildouts that this function is more restrictive than it should be to css work. Namely, I can't alter the output/replace it with something that accommodates a class value, for example. Currently this only accepts the ID attribute but at the very least I believe we shouldn't need to use JS to append class(es) to individual section divs.
Thanks, keep up the great work...
The text was updated successfully, but these errors were encountered: