function sharedblocks_publish_block in Shared Blocks 7
Same name and namespace in other branches
- 6 sharedblocks.module \sharedblocks_publish_block()
- 7.2 sharedblocks.publish.inc \sharedblocks_publish_block()
Page callback for block publish callback.
1 string reference to 'sharedblocks_publish_block'
- sharedblocks_menu in ./
sharedblocks.module - Implements hook_menu().
File
- ./
sharedblocks.module, line 419
Code
function sharedblocks_publish_block($module, $delta) {
$blocks = variable_get('sharedblocks_publish', array());
if ($blocks[$module][$delta]) {
// Load the block.
$block = module_invoke($module, 'block_view', $delta);
if (is_array($block)) {
// Translate relative URLs into absolute ones.
// NOTE: Only works with double quotes..
// @todo: see about capturing ('|") and then matching %2 at end
// @todo: make this work with the render array
$regex = '~(href|src|HREF|SRC)="(\\/.+?)"~';
//$block['content'] = preg_replace($regex, '\\1="' . $GLOBALS['base_url'] . '\\2"', $block['content']);
drupal_json_output($block);
return;
}
}
// If you get here, something has gone wrong.
return MENU_NOT_FOUND;
}