function _insert_block_substitute_tags in Insert Block 5
Same name and namespace in other branches
- 6 insert_block.module \_insert_block_substitute_tags()
1 call to _insert_block_substitute_tags()
File
- ./
insert_block.module, line 52
Code
function _insert_block_substitute_tags(&$node, $field) {
if (preg_match_all("/\\[block:([^=\\]]+)=?([^\\]]*)?\\]/i", $node->{$field}, $match)) {
foreach ($match[2] as $key => $value) {
$module = $match[1][$key];
$delta = $match[2][$key];
$block = module_invoke($module, 'block', 'view', $delta);
$mtch[] = $match[0][$key];
$repl[] = theme('insert_block_block', $block);
}
return str_replace($mtch, $repl, $node->{$field});
}
return $node->{$field};
}