Closed (duplicate)
Project:
MultiBlock
Version:
7.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
5 Jul 2012 at 18:44 UTC
Updated:
29 Aug 2012 at 03:27 UTC
Jump to comment: Most recent file
D7 block api functions configure() and view() don't use the $edit variable. So, it must be passed during multiblock's invokation of these hooks.
Quickfix for the configure hook:
diff --git a/sites/all/modules/multiblock/multiblock.module b/sites/all/modules/multiblock/multiblock.module
index aeedc6c..8c56ca1 100644
--- a/sites/all/modules/multiblock/multiblock.module
+++ b/sites/all/modules/multiblock/multiblock.module
@@ -61,7 +61,7 @@ function multiblock_block_configure($delta = 0, $edit = array()) {
/**
* Fetch a given block from the multiblock database table.
- *
+ *
* @param $delta
* Optional. Retreive a single block based on this delta. If none specified,
* all multiblock instances are returned.
@@ -99,12 +99,9 @@ function multiblock_call_block($delta, $op, $edit) {
'#value' => $block_info->delta,
);
}
- if ($op == 'save') {
- $block = module_invoke($block_info->module, 'block_'. $op, $block_info->orig_delta, $edit);
- }
- else {
- $block = module_invoke($block_info->module, 'block_'. $op, $block_info->orig_delta);
- }
+
+ $block = module_invoke($block_info->module, 'block_'. $op, $block_info->orig_delta, $edit);
+
return $block;
}
// No such multiblock, shouldn't ever happen.
@@ -157,7 +154,7 @@ function multiblock_add_form($form, &$form_state, $blocks, $update = NULL) {
else {
// Turn $blocks into form options of block types.
// Remember we need the module and delta to be able to tell what kind of
- // blocks we're talking about.
+ // blocks we're talking about.
$options = array();
foreach ($blocks as $block) {
// Don't include multiblock module blocks in the list.
@@ -165,7 +162,7 @@ function multiblock_add_form($form, &$form_state, $blocks, $update = NULL) {
$options[$block['module'] .'***MB***'. $block['delta']] = $block['info'];
}
}
-
+
$form['block'] = array(
'#type' => 'select',
'#title' => t('Block type'),
@@ -345,11 +342,11 @@ function theme_multiblock_general($variables) {
extract($variables, EXTR_SKIP);
$output = '';
$noyes = array('misc/watchdog-error.png', 'misc/watchdog-ok.png');
-
+
$output .= '<p><h3>'. ($edit ? t('Edit Instance') : t('Add Instance')) .'</h3>'. $add_block_form .'</p>';
-
+
$header = array(t('Title'), t('Original Block Title'), t('Original Module'), t('MultiBlock Enabled'), t('Original Delta'), t('Action'));
-
+
$rows = array();
foreach ($multiblocks as $row) {
$ops_link = l(t('Edit'), 'admin/structure/block/instances/edit/'. $row->delta)
Still not working for the view hook.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | multiblock-D7.patch | 650 bytes | folkertdv |
Comments
Comment #0.0
mrevd commentedcoded
Comment #1
folkertdv commentedConfiguration per instance is currently impossible in Drupal 7, because the multiblock_delta is indeed never passed to hook_block_configure and hook_block_view. Attached is a "cleaner" patch to fix it for Drupal 7.
To the maintainer: There hasn't been an update in 20 weeks, while the module is listed as "actively maintained". I hope this fix gets applied soon.
Comment #2
pablitt commentedActually, i had the exact same discussion in this thread that was closed by the maintainer: http://drupal.org/node/1370966
I reopened it, though, with a more D7 friendly fix(we don't need to pass an array for view and configure block hooks).
Hope it helps.
Cheers.
Comment #2.0
pablitt commentedinaccurate