Problem/Motivation

The Block Group module works by injecting dynamically generated regions into the region list of all themes. The regions machine names are generated by prefixing the block groups machine names with blockgroup and a hyphen. However according to a comment on DA region names may not contain any hyphens:

If your region has a dash, then it doesn't seem to matter what you use... the template doesn't get picked up. – Beebee

Regrettably the problem is not resolved by just replacing the dashes with underscores in the Block Group source code. Because block group machine-names also use dashes instead of underscores. Therefore the names of existing Block Groups need to be updated on sites using this module.

Proposed resolution

Fix the issue in a new major version of Block Group.

Remaining tasks

  1. Create new branch and fix the issue
  2. Release an alpha (without upgrade path from current major version)
  3. Find an upgrade path for current sites
  4. Release new stable version

User interface changes

none

API changes

none

Original report by @muhkhwishla

I can't use template hook suggestion file for example region--blockgroup-mygroup.tpl.php.
I check the regions array and despite there is that file added in the hooks it doesn't work at all.
I checked it with devel enabled and template caching disabled. The file name is correct and I can use hooks for normal regions and they work properly.

Comments

dmaciej’s picture

Issue summary: View changes
znerol’s picture

Title: Can't use template hook suggestion for region.tpl » Use underscore instead of hyphen for dynamically generated region names
Assigned: Unassigned » znerol
Issue summary: View changes

Thanks for the report. This issue actually points to a really bad design error.

znerol’s picture

Issue summary: View changes
znerol’s picture

Status: Active » Needs review
StatusFileSize
new5.83 KB
znerol’s picture

Status: Needs review » Fixed

Took a stab on an update hook today. I do not think it is feasible to implement an update routine because of the following reasons:

  • The source of the infamous message The block X was assigned to the invalid region Y and has been disabled. is the function _block_rehash. This can be called in many circumstances, also on the block administration page. As soon as this function is called, block groups created with the old module (using hyphens in the machine name) will lose all their blocks contained.
  • Block configuration is spread over three tables in core (block, block_node_type and block_role). Contrib modules add additional configuration via other means (more tables, variables, serialized data (e.g. context)).

Committed and pushed bed1bd5.

znerol’s picture

Version: 7.x-1.0 » 7.x-2.x-dev

Status: Fixed » Closed (fixed)

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

amaisano’s picture

The template is still not being picked up. I've deleted that tpl file all together and it's still rendering the default output.

znerol’s picture

@amaisano: Please make sure you've installed Block Group 7.x-2.1. Also note that this issue is closed, I only noticed the update per chance. Please open a new support request if the problem persists.

amaisano’s picture

So a vanilla 7.x-2.1 install should pick up the tpl override? I will give it another shot, but I will open a separate issue if it still doesn't work. Thanks.