Originally Posted by
Ruud
I was intrigued by that suggestion. But I'd like to change some other things first; for example adding the fields to the root page as well. That way a multi domain setup can specify classes per root.
The style option you suggest would have to be available in the select box, only if the style is applied to the current content elements->articles->pages->layouts->stylesheet so that might be an even more expensive query (more expensive then my root idea). Do you have a good suggestion to do that?
(thinking aloud)
starting from inside a content_element dca callback the assigned layout is (pseudo-code):
Code:
// pseudo-code
$layout =
SELECT layout FROM tl_page WHERE id=(SELECT pid FROM tl_article WHERE id={$dc->activeRecord->pid}) AND includeLayout='1'
// plus a query if the page uses a default layout
@see PageRegular::getPageLayout
then select stylesheets from the specified layout:
Code:
// pseudo-code
$stylesheets =
SELECT stylesheet FROM tl_layout WHERE id={$layout}
// deserialzie
// implode
then the final query
Code:
// pseudo-code
SELECT selector, content_cssid_label FROM tl_style WHERE pid in ({$stylesheets}) AND content_cssid_flag = '1'
by taking advantage of Contao query caching I think this is not so expensive compared to the benefit of having the css selector auto updated each time you add a new style selector
another idea:
- left the class as text field an then implement a checkbox selector (that opens in popup) this way the user can choice multiple classes
Bookmarks