Problem/Motivation

Now if you need a specific styling for a section you need to create a "modifier" settings with a css class name. If you need to assign the class only one time in the whole website, the method is too complicated.

Moreover you also could need to assign an ID to a section (useful if you need to create some anchors in the content).

Proposed resolution

Add two fields on the section settings for both Class and ID.

CommentFileSizeAuthor
#5 3197768-5.patch3.95 KBrpayanm
#4 3197768-4.patch3.37 KBrpayanm

Comments

FiNeX created an issue. See original summary.

phjou’s picture

Hello,

I agree that the ID feature would be great. On the other hand, I don't get what is the issue with the modifier.

There is already a "modifier" where you can add custom classes. By default the layouts provided by the module have none but you can edit the config form to add some or you can implement the getModifiersOptions method if you have a custom Layout.
If your class is used only once in the whole website, I guess this class should be directly in your template because this class will show up as a choice everytime someone is building a layout.

finex’s picture

Just thinking: if the style is needed only one time for a specific layout section in the whole website, and I've the ID field, I can use the ID to style that specific section. Is the style is needed more than once, then the "modifier" way is fine :-)

Having the ID field could be enough :-)

rpayanm’s picture

Status: Active » Needs review
StatusFileSize
new3.37 KB

Here is the patch to add ID and extra classes to any layout.

rpayanm’s picture

StatusFileSize
new3.95 KB

I added the Id and classes fields inside a details container.

finex’s picture

It looks good. Thank you.

  • phjou committed fb87d84 on 8.x-1.x authored by rpayanm
    Issue #3197768 by rpayanm: Custom CSS Class and ID on sections
    
phjou’s picture

Status: Needs review » Fixed

Thank you for the patch. Commited

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.