How to use tables that are claimed by other modules in drupal?

I have a table in my database named "dictionary" used by a module for translation . now i want to use that table in views to show all data of that table. Is there any method by which i can use that table?


You can expose information from other modules/"orphan" database tables from your own module by using hook_views_data in case nobody is exposing that table to views then you would "claim" it with all the consequences. If the table is already exposed to views but you want ton enhance the integration, you can use then hook_views_data_alter for adding fields, altering filters, etc.

You can find an example of how to implement a hook_views_data in the views documentation.


There is a great presentation available here on exactly the same topic from Drupalcon NY 2011. It is a step by step guide to solve a similar problem.

You should also look at their blog here, it also contains a downloadable zip of the source code used for the presentation. You should be able to edit the files in the zip to get your stuff working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.