Theme hook for block replacements

jonga - December 12, 2008 - 13:04
Project:Rep[lacement]Tags
Version:6.x-1.x-dev
Component:Code / API
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Will it be possible to provide a theme hook for block replacements passing only the $block object?

#1

profix898 - January 10, 2009 - 12:33

Yes, that would be possible. But you only have to call reptag_replace() on $block->content, so not sure this is really needed.

#2

jonga - January 10, 2009 - 19:22

Added this in block.tags.inc

function _reptag_block_render($module, $delta) {
    $block = module_invoke($module, 'block', 'view', $delta);
    $block['module'] = $module;
    $block['delta'] = $delta;
    return theme('reptag_block', $block);
}

function theme_reptag_block($block) {
    return theme('block', (object)$block);
}

function _reptag_block_theme() {
  return array(
    'reptag_block' => array(
      'file' => 'block.tags.inc',
      'path' => drupal_get_path('module', 'reptag') .'/tags',
      'arguments' => array('module' => NULL, 'delta' => NULL),
    )
  );
}

And also changed the following:

    "#{BLOCK:(.*?):([0-9]+)}#e"    => "_reptag_block_render('\\1', '\\2');",

 
 

Drupal is a registered trademark of Dries Buytaert.