Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Collapsiblock assumes that block IDs have the form 'block-module-delta'. However, some themes might use a different pattern. For example, a custom theme I had to deal with was replacing all underscores in IDs with dashes, which caused Collapsiblock to not work with blocks whose module or delta contained an underscore.
This patch allows a theme to override the block ID format through a theme function. It also avoids directly using block IDs in the 'collapsiblock_settings' variable so that the settings can work with any theme.
Comment | File | Size | Author |
---|---|---|---|
#2 | collapsiblock-block-id-718800-2.patch | 4.56 KB | pfournier |
collapsiblock-block-id.patch | 4.06 KB | David Lesieur |
Comments
Comment #1
gagarine CreditAttribution: gagarine commentedcollapsiblock change... this patch doesn't work anymore.
But now you can set your block ID for each theme in theme settings.
Comment #2
pfournier CreditAttribution: pfournier commentedThis patch is still relevant. I ported it to 6.x-1.0.
As David said, themes do not necessarily give the blocks an #id in the form 'block-module_name-delta_id', as collapsiblock assumes. For example, the theme we are using replaces the underscores in the module name and delta id by hyphens.
The patch allows the theme to define the block id selectors used by collapsiblock to apply block specific settings (not collapsible, open by defaut, etc.) by overriding the theme_collapsiblock_id function. This is different from the selectors defined in the theme settings.
Note that this patch does not store the settings in the same way the previous patch did: instead of using a string as the key of the array, it uses the module and the delta. This way, we do not need to split the key using any special character.
Comment #3
darvanenTo be considered in v2
Comment #4
darvanen