Search code examples
drupalmodulecruduser-permissionsform-api

Should custom form module in drupal be a node type?


I just started to develop a new module in Drupal. The goal of the module is to capture user's data (purely CRUD). I had been using CakePHP so far and now planning to switch to Drupal.

I am using Drupal's Form API to create a form page.I have almost completed 'Create' operation. I have a few of questions before I go too far.

  1. Should this form be a Drupal's content/node type?
  2. Can I reuse the 'Create' source for 'Update' operation? (like in CakePHP)?
  3. How does the permissions work with this kind of module?

PS: My form is highly customized so I am not up for using CCK/Views. And, I am also very confused after doing some CakePHP. I keep relating CakePHP and Drupal. :/


Solution

  • These examples are nice thing to start:

    1. If you form don't work with nodes, it willn't. Otherwise investigate *node_example* and *nodeapi_examples*.
    2. Yes, you should send argument via menu definition, that identify ID and load it from DB. After this assign loaded values to #default_value. So http://site.com/YOURFORMPATH will used for creation, http://site.com/YOURFORMPATH/ID for updating/deleting.
    3. See *menu_example* how menu defined with permissions. and define for your "YOURFORMPATH" menu item.