简体   繁体   English

drupal中的自定义表单模块应该是节点类型吗?

[英]Should custom form module in drupal be a node type?

I just started to develop a new module in Drupal. 我刚刚开始在Drupal中开发一个新模块。 The goal of the module is to capture user's data (purely CRUD). 该模块的目标是捕获用户数据(纯CRUD)。 I had been using CakePHP so far and now planning to switch to Drupal. 到目前为止,我一直在使用CakePHP,现在计划切换到Drupal。

I am using Drupal's Form API to create a form page.I have almost completed 'Create' operation. 我正在使用Drupal的Form API创建表单页面。我几乎完成了“创建”操作。 I have a few of questions before I go too far. 在我走得太远之前,我有几个问题。

  1. Should this form be a Drupal's content/node type? 这种形式应该是Drupal的内容/节点类型吗?
  2. Can I reuse the 'Create' source for 'Update' operation? 我可以将“创建”源重新用于“更新”操作吗? (like in CakePHP)? (例如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. PS:我的表单是高度定制的,因此我不愿意使用CCK / Views。 And, I am also very confused after doing some CakePHP. 而且,在做完CakePHP之后,我也很困惑。 I keep relating CakePHP and Drupal. 我一直联系着CakePHP和Drupal。 :/ :/

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*. 否则,请调查* node_example *和* nodeapi_examples *。
  2. Yes, you should send argument via menu definition, that identify ID and load it from DB. 是的,您应该通过菜单定义发送参数,该参数标识ID并从DB加载它。 After this assign loaded values to #default_value . 之后,将加载的值分配给#default_value So http://site.com/YOURFORMPATH will used for creation, http://site.com/YOURFORMPATH/ID for updating/deleting. 因此,将使用http://site.com/YOURFORMPATH进行创建,使用http://site.com/YOURFORMPATH/ID进行更新/删除。
  3. See *menu_example* how menu defined with permissions. 请参阅* menu_example *如何使用权限定义菜单。 and define for your "YOURFORMPATH" menu item. 并为“ YOURFORMPATH”菜单项定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM