Index: insert_block.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/insert_block/insert_block.module,v retrieving revision 1.8 diff -u -p -r1.8 insert_block.module --- insert_block.module 8 Jan 2009 16:46:55 -0000 1.8 +++ insert_block.module 21 May 2009 19:43:26 -0000 @@ -72,47 +72,26 @@ function insert_block_filter($op, $delta function _insert_block_substitute_tags($text) { if (preg_match_all("/\[block:([^=\\]]+)=?([^\\]]*)?\]/i", $text, $match)) { + $raw_tags = $repl = array(); foreach ($match[2] as $key => $value) { - $raw_tags[] = $match[0][$key]; $module = $match[1][$key]; $delta = $match[2][$key]; - $block = module_invoke($module, 'block', 'view', $delta); + $block = (object) module_invoke($module, 'block', 'view', $delta); + if (isset($block->content)) { + init_theme(); + global $theme_key; + $title = db_result(db_query("SELECT b.title FROM {blocks} b WHERE b.theme = '%s' AND b.module = '%s' AND b.delta = '%s' LIMIT 1", $theme_key, $module, $delta)); + $block->subject = $title == '' ? '' : check_plain($title); + $block->module = $module; + $block->delta = $delta; + $block->region = 'insert_block'; - $repl[] = theme('insert_block_block', $block); + $raw_tags[] = $match[0][$key]; + $repl[] = theme('block', $block); + } } return str_replace($raw_tags, $repl, $text); } return $text; -} - -/** - * Implementation of hook_theme(). - */ -function insert_block_theme() { - $themes = array( - 'insert_block_block' => array( - 'arguments' => array('block'), - ), - ); - return $themes; -} - -/** - * Format an included block. - * - * Gets passed the block array to be formatted. By default it includes - * the block subject, if any, and the block's content. - * - * @ingroup themeable - */ -function theme_insert_block_block($block) { - $content = ''; - if (!empty($block['subject'])) { - $content .= '

'. $block['subject'] .'

'; - } - if (!empty($block['content'])) { - $content .= $block['content']; - } - return $content; -} +} \ No newline at end of file