When creating a content type I would like to have a field type that could be used to call a rest service or make a db call to an external database. Does this exist?

  • Thanks for the fast reply, What I was thinking when you add a new field to a content type could it field type of Service or External Data source. Then you could create a service call to retrieve the info be it a rest service or a database call. I am very new to drupal so there may already be an answer. I know you can put a hack in to do it but was looking for a solution before I spent to much time on it. – Russ Jan 10 '14 at 16:52

To the best of my knowledge, no, there isn't a module out there to do this. I have seen something similar done in the past though, where a node would have an id of some sort provided, and a module would connect to an external service to load in information for the node.

I suspect you might want to think about writing a custom module to do this. If you haven't taken a look at https://drupal.org/developing/modules yet you might want to. Just remember when modifying functionality of Drupal you should never hack the core, but create/use a module instead.

I think what your gonna want to do is architect a way to know what you need to pull and from where, then use hook_node_view to change/add the data you pull from your DB/external service (https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_view/7)

| improve this answer | |

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.