How to configure blocks per node? I'd like to build a Drupal 7 module that generates a block which contains (along with some static HTML to be used as template for a JavaScript library) a node-specific value to be passed on to a web service. (The web service will return relevant data for the contents of the node.)

How should a block receive node-specific data? Module configuration seems to be global, and blocks cannot be configured individually.

Should I modify the main content-type of the node by adding this "node-specific data" as an extra field even if this value is only used in my module?
Use the Block API to add the blocks

i.e:


hook_block_info
hook_block_view


Use menu_get_object to get the node object for that page.

e.g:

function mymodule_block_view($delta){
  $block = array();
  switch($delta){
    case 'my_delta':
     if ($node = menu_get_object('node') &amp;&amp; $node-&gt;type == 'my_type') {
       $block['subject'] = t('Example block on %node', array('%node' =&gt; $node-&gt;title));
       $block['content'] = render(field_view_field('node', $node, 'body')); // for example
     }
    break;
  }
  return $block;
}