TSP Posted August 24, 2015 Posted August 24, 2015 When a block is added in a widget position, it receives an outer li-class as such: <li class="ipsWidget ipsWidget_horizontal ipsBox" data-blockid="app_cms_Blocks_52wbf4kut" data-blockconfig="true" data-blocktitle="Egne blokker" data-controller="core.front.widgets.block"> My block html </li>I may want to target the ipsWidget-class only for a specific block I've made in Pages because I don't want it to have the padding added for instance. I can technically target it as such: .ipsWidget[data-blockid="app_cms_Blocks_52wbf4kut"], but this have some downsides: It's not obvious what I'm targeting (Unless I leave a CSS-comment)I can't feel sure the ID wont changeThe ID will be different for each positionThe ID will be different for the same block across different communitiesI could also be more general and target .ipsWidget[data-blockid="*app_cms_Blocks"], but I may not want the same rules to apply to all blocks. My suggestion is: If a template key is defined for the custom pages block, then incorporate that template-key into the li-element. Some options on how to go about this:Add it as a class. For instance class='ipsWidget ipsWidget_horizontal ipsBox custom-block-mykey'Add it to data-blockid: data-blockid="app_cms_Blocks_mykey_52wbf4kut"Add it to the controller. For example: data-controller="core.front.widgets.block.mykey or data-controller="core.front.widgets.block,core.front.widgets.block.mykey"
bradl Posted August 24, 2015 Posted August 24, 2015 I have no idea on the feasibility issues associated but I definitely support the feedback.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.