0

I am reasonably new to Drupal, I have written a couple of basic modules by following the excellent videos from buildamodule.com

Now I need to somehow integrate an existing table into a drupal site. I would like this table to be accessable as a content / node type to the rest of the drupal system. I do not want to add this as a content type to drupal and use the table per field system drupal has as I already have the table structure and need to be able to update the data in this table from an external source.

I tried creating a new content type in a module and was able to create a schema using the schema module. However when i use field_create_field and field_create_instance I end up with a seperate set of fields.

How do I create a new content type in a module that can use an existing table for its data ( even if I need to provide access functions in my module)?

Is there a good tutorial somewhere that someone knows of?

  • 1
    Have a look at the Ubercart module and the way they integrated the product content type with their product table. Might give you some ideas. – Triskelion Mar 17 '13 at 21:34
  • Can you provide more details about "integrate an existing table"? Anything else apart from query / display those date in your Drupal site? – Pierre.Vriens Jul 14 '16 at 5:57
1

While you're making work for yourself using a custom table and not the Field API, you can use your own table with

You'll probably also need

if you want to add form elements to the node form.

Keep in mind the Field API will do that all for you though if using standard fields.

  • My problem is I want to be able to manipulate the db table from outside drupal which is more combersome with 10 tables - 1 for each field – Toby Allen Mar 18 '13 at 9:11
  • You can use the Drupal API from outside Drupal with a standalone PHP script. e.g: stackoverflow.com/a/5015816/583715 – David Thomas Mar 19 '13 at 2:30

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.