How to add custom class to layout?

Permalink 1 user found helpful
I'm not sure if I'm being extremely dim here.

I want to add a custom class to a layout via page_theme.php so that it is available as a pickable custom class in the UI when I select 'Edit Layout Design' on an already existant layout with blocks inside.

If I click on 'Edit Layout Design' on a layout I have already added, the pop-up allows me to select the parallax custom template, or I can change the block container class to either enable or disable the grid container

but, where / how do I add custom classes via page_theme.php to make them selectable in the custom classes selector on this form?

Any ideas - I suspect I'm just being a bit dim and missing the obvious.

 
Steevb replied on at Permalink Best Answer Reply
Steevb
Not selectable using the 'page_theme.php', but what I've done in the past is add a 'class' to my css/less file and then type the class into the form.

e.g: Class in the css file is '.blue', which gives the area a blue background and makes the text white.

I type in the 'Custom Class' box 'blue' and click the blue box below.
WebcentricLtd replied on at Permalink Reply
Hi Steev,
thanks for confirming - I wanted to make sure I hadn't missed something obvious. I've been adding the classes in manually as I've been building the theme out but when it comes to a customer adding content in then asking them to remember class names is a bit of a stretch.
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi AndyJ,

I don't think there is a page_theme.php method for adding custom classes to layouts.
http://documentation.concrete5.org/api/class-Concrete.Core.Page.The...

You might want to make a GitHub issue to suggest that feature.
WebcentricLtd replied on at Permalink Reply
Good idea Karl,
I'll raise it on Github - I think there definitely needs to be a way to set those styles in the theme as it is just a big disconnect - everything else you can choose from one picklist or other then suddenly you need to know a class name and key it in.
ramonleenders replied on at Permalink Reply
ramonleenders
They did build in "Area Classes" though. Perhaps you can do something with that, untill this is available?

http://documentation.concrete5.org/developers/designing-for-concret...

But yeah, seems this functionality has been forgotten or is still on the todo-list. I'm sure they have plenty of stuff to do, so I don't blame 'em haha.
WebcentricLtd replied on at Permalink Reply
Hi Ramon,
you're absolutely right - but this will apply the style(s) to the whole area rather than just a layout within an area - which for me at the moment is the missing piece. It's not a show-stopper as the ability to add classes is there - just not in the same way as the other parts of the interface.
ramonleenders replied on at Permalink Reply
ramonleenders
True, it will be adding it to the whole area. I thought perhaps you can use it for your current situation. Just trying to give alternatives, if you don't want to enter it all manually :)
WebcentricLtd replied on at Permalink Reply
hi, it is definitely a good suggestion and would work. Normally I probably would just do that - it's just in this case there are pages with lots of content in lots of custom layouts with lots of nested styles. I don't really want to add lots of areas and also then have to have 'spare' ones doing nothing for possible expansion.
lewismcarey replied on at Permalink Reply
Hi Andy,
Adding a block handle 'core_area_layout' inside getThemeBlockClasses() in page_theme.php will give you classes for your layouts as a whole (but not granularly to individual preset handles).
Steevb replied on at Permalink Reply
Steevb
I suppose the other way would be to make some templates and put them in with the 'parallax' template?
WebcentricLtd replied on at Permalink Reply
What a good idea. I'll have to have a look to see how they can be added outside of the core but that would definitely work.
Steevb replied on at Permalink Reply
Steevb
I presume you would copy 'core_area_layout' from core blocks to 'application' blocks, rename and add templates?
WebcentricLtd replied on at Permalink Reply
that's what I'll try first. I know you can't just override everything in 5.7 like you could in 5.6 - but then I guess this isn't an override. If I do have to do anything differently I'll post it back here.
WebcentricLtd replied on at Permalink Reply
yep - that works fine
Steevb replied on at Permalink Reply
Steevb
Good news.
Meant to say to rename controller path, but you must have worked that out!