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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gagarine’s picture

Status: Needs review » Closed (fixed)

collapsiblock change... this patch doesn't work anymore.

But now you can set your block ID for each theme in theme settings.

pfournier’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Closed (fixed) » Needs review
FileSize
4.56 KB

This 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.

darvanen’s picture

Version: 6.x-1.0 » 7.x-1.x-dev
Issue summary: View changes
Status: Needs review » Patch (to be ported)
Parent issue: » #1186198: Collapsiblock v2 for Drupal 7

To be considered in v2

darvanen’s picture

Version: 7.x-1.x-dev » 6.x-1.0
Status: Patch (to be ported) » Closed (outdated)