Currently, in the function multiblock_call_block(), calls are made to other modules' hook_block_save(), hook_block_configure(), hook_block_view() functions, but the $edit parameter, which contains important information about which instance of a block we're dealing with, only applies to calls to hook_module_save().

This makes it impossible to know which instance we're dealing with when in a module's configure or view hook.

#1672498: Invoke 'block_view_alter' hooks for complete construction of a block has been suggested to get around this, but a better solution, in my view, would be to pass an extra $edit paramter to all block-related hooks when a module declares multiblock-enabled blocks.

This extra parameter allows all block-related hooks to know if they are dealing with the original block, or an instance thereof.

Furthermore, sending an $edit parameter when one is not in the function signature does not seem to cause any ill effects, even with E_STRICT error reporting.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alberto56’s picture

Status: Active » Needs review
FileSize
2.54 KB

Here is a patch

cbeier’s picture

Status: Needs review » Reviewed & tested by the community

The patch looks good to me.

emilymoi’s picture

The patch works but I think it's odd that we're passing 'edit' into view and configure hooks.

Is there a reason we're passing the $edit['multiblock_delta'] as a render array style value in the first place? This seems overly confusing to me. Why not just append the delta to the module invoke call as another parameter? Then we can use the same pattern for view and configure.

  • intrafusion committed 475f11b on 7.x-1.x authored by alberto56
    Issue #2112485 by alberto56: Provide information about multiblock to all...
intrafusion’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

This patch has been applied and a new release has been rolled

  • intrafusion committed 475f11b on 8.x-1.x authored by alberto56
    Issue #2112485 by alberto56: Provide information about multiblock to all...

Status: Fixed » Closed (fixed)

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