1

I have used hook_schema() in my module to create a custom table in the Drupal database - the data is unrelated to anything in Drupal.

I would like administrators to be able to insert, update etc. records in this custom table. I had thought to use the function hook_form() for this, but upon closer inspection this hook relates back to nodes. My custom table has no relation to nodes.

Is there a different function I should be using?

  • First, there is not one hook for that. Second, what Drupal version are you using? Because form api changed quite a lot. – Mołot Dec 22 '15 at 15:16
  • My module is for Drupal 7 – gretzo3829 Dec 22 '15 at 15:30
1

You don't need to call any special hooks. You just need to create menu items for insert/edit/delete/list of data.

Here is an example module that create basic crud using custom table.

If you want to create listing with views instead of custom listing callback function you will need to use view_api and hook_views_data in your module for that.

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.