Thanks good people here, I have create a simple module which generate two blocks as follows:
function myblockmodule_block_info(){
$block['myadblocks'] = array(
'info' => t('My first ad blcoks'),
'cache' => DRUPAL_CACHE_GLOBAL,
);
$block['myadblocks2'] = array(
'info' => t('My second ad blcoks'),
'cache' => DRUPAL_CACHE_GLOBAL,
);
return $block;
}
/**
* Define what our block is going to look like.
* Implements hook_block_view().
*/
function myblockmodule_block_view($block_key){
$block = array();
if($block_key == 'myadblocks'){ //We only want to define the content of OUR block
//This is the title of the block.
$block['subject'] = '';
//Define the block content.
$block['content'] = '<script>some ad js comes here</script>';
}
elseif ($block_key == 'myadblocks2') {
$block['subject'] = '';
$block['content'] = '<script>some other ad js</script>';
}
return $block;
}
My intention is to user these blocks instead of my current blocks that were volnurable to to script injection.
However, I am not sure the new module-based blocks will be more secure than the old admin-generated blocks. So appreciate your critical review of the module above.