Views: alter data of a View of another module I wanted  to add a relationship to data in a View of an existing module, so I've hacked the code (the function modulename_views_data) and it works.

Now I want to create a new  module to do this extension, leaving clean the original one. I guess I should use the function views_data_alter(&amp;$data) but I don't understand how to bind it to the other module.
You would create a module.  It only needs a simple modulename.info file and modulename.module file.

If you called your module 'mymodule', then in mymodule.module add the function:

mymodule_views_data_alter(&amp;$data) { 
  \\custom code
} 


Clear the caches and you should be good to go.

The hook system allows modules to interact with other modules code. By naming your function MODULENAME_views_data_alter you are telling Drupal that you want to take advantage of the hook HOOK_views_data_alter.