If I assign more than one block to the content region in a fusion_core subtheme, they get the wrong width classes assigned to them. The width assigned to each block, where there are x blocks present, is 1/x * width of the content region, which is calculated correctly. So if I have 2 blocks in the region, they each take up half the width of the region; 3 blocks, one third; 4 blocks, a quarter, etc.
It seems to be this snippet from template.php, within fusion_core_preprocess_block() causing the problem:
if (strpos($classes, $grid['name']) === false && $assign_grid_units) {
// Stack blocks vertically in sidebars by setting to full sidebar width
if ($vars['block']->region == 'sidebar_first') {
$width = $grid['fixed'] ? $grid['sidebar_first_width'] : $grid['width']; // Sidebar width or 100% (if fluid)
}
elseif ($vars['block']->region == 'sidebar_second') {
$width = $grid['fixed'] ? $grid['sidebar_second_width'] : $grid['width']; // Sidebar width or 100% (if fluid)
}
else {
// Default block width = region width divided by total blocks, adding any extra width to last block
$region_width = ($grid['fixed']) ? $grid['regions'][$vars['block']->region]['width'] : $grid['width']; // fluid grid regions = 100%
$width_adjust = (($region_count == $total_blocks) && ($region_width % $total_blocks)) ? $region_width % $total_blocks : 0;
$width = ($total_blocks) ? floor($region_width / $total_blocks) + $width_adjust : 0;
}
$vars['classes_array'][] = $grid['name'] . $width;
}
Maybe we need another condition for $vars['block']->region == 'content'?
Comments
Comment #1
mshepherd commentedpatch for the above.
Comment #2
sheena_d commentedTechnically, this is by design, although we have decided to change this functionality moving forward. This issue is also a duplicate :) Please see this thread: http://drupal.org/node/1277534
Comment #3
aquariumtap commentedYeah, we need to get rid of this sort of magic. Users can assign grid units to blocks with Accelerator.
Comment #4
mshepherd commentedThanks. When I was trying to edit the skin of the content block earlier, I think I'd hidden its contextual link under the node's contextual links & thought I couldn't edit the content blocks skin. My mistake & sorry for the dupe.
I agree about setting widths with Fusion Apply. Should be the norm.