On block view, it would be handy to have the original block delta and module in the new multiblock instance, so that the newly created instance could have a class that displays the original block and delta for styling.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jjeff’s picture

Actually, that patch had some major problems. Here's an updated version that actually works. :-)

quicksketch’s picture

For the D5 version the original patch is going to be as good as we can do, we don't get preprocess hooks in D5 :(

Though noted, the block seems to be an array, not an object at that point.

andrewlevine’s picture

quicksketch et al., if this information is useful in the view op, is there any reason we shouldn't include it in all the other ops?

quicksketch’s picture

As jjeff informed me, the block object isn't always an object (or array, whatever) during all operations. Though I agree that it would probably be helpful in more operations than just view.

andrewlevine’s picture

quicksketch, now that I think about it, I made the whole multiblock_enabled thing to give you the delta of the block. Couldn't you use that to get the same info?

andrewlevine’s picture

Status: Needs review » Postponed (maintainer needs more info)
NancyDru’s picture

Something I thought as I was trying to understand this is that some people have their CSS set up for specific blocks as natively generated. It might be more of a point to somehow tell the theme layer that the original module created the block rather than MB, perhaps with the addition of the instance ID.

NancyDru’s picture

To some extent #346513: block-{region}.tpl.php not used is part of this discussion as well.

NancyDru’s picture

I've been trying something similar to jjeff's patch. In function multiblock_call_block, I did:

    $block = module_invoke($block_info->module, 'block', $op, $block_info->orig_delta, $edit);
    if ($op == 'view') {
      $block['orig_module'] = $block_info->module;
      $block['orig_delta'] = $block_info->orig_delta;
    }
    return $block;

And then I modified block.tpl.php like this:

<?php
// $Id: block.tpl.php,v 1.3 2007/08/07 08:39:36 goba Exp $
  global $user;
  $classes = 'clear-block block block-'. $block->module;
  if (!empty($block->orig_module)) {
    $classes .= ' block-'. $block->orig_module;
    $classes .= ' block-'. $block->orig_module .'-'. $block->orig_delta;
  }
?>
<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="<?php print $classes ?>">

<?php if (!empty($block->subject)): ?>
  <h2><?php print $block->module == 'user' ? theme('username', $user) : $block->subject ?></h2>
<?php endif;?>

  <div class="content"><?php print $block->content ?></div>
</div>

This passes the original module and delta to the template, which then adds what would have been the original ID as a class (can't nest div's because you could then have duplicate IDs which would fail validation).

This should work in both 5.x and 6.x. The downside is that 5.x users would have to copy the template to their theme directory, which means it's out of our ability to maintain it. However, I think that is a small risk.

intrafusion’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (won't fix)

Issue closed as last post 7 years ago

leeomara’s picture

Version: 5.x-1.0 » 7.x-1.x-dev
Status: Closed (won't fix) » Needs review
FileSize
1.33 KB

I've updated the patch from #1 to work with current 7.x version of multiblock. The CSS class names now match what block.module does by default.

  • leeomara authored c49a62a on 7.x-1.x
    Issue #266307 by quicksketch, jjeff, leeomara: Add original block module...
intrafusion’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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