Should custom form module in drupal be a node type?
-
26-05-2021 - |
Question
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.
- Should this form be a Drupal's content/node type?
- Can I reuse the 'Create' source for 'Update' operation? (like in CakePHP)?
- 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:
- If you form don't work with nodes, it willn't. Otherwise investigate *node_example* and *nodeapi_examples*.
- 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.
- See *menu_example* how menu defined with permissions. and define for your "YOURFORMPATH" menu item.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow