简体   繁体   English

Drupal-表单中的块,页面中的内容

[英]Drupal - Form in block, content in page

I have a custom form with some content that depends on some variables. 我有一个自定义表单,其中包含一些内容,这些内容取决于某些变量。 At this time, those variables are hardcoded but I want the user to be able to choose them in a block. 目前,这些变量已经过硬编码,但是我希望用户能够在一个块中选择它们。 I know how to make a block in drupal but how can I connect both the block (form) and the content page? 我知道如何在drupal中制作一个块,但如何连接块(窗体)和内容页面?

您可能需要使用hook_block_configure()

Print the form from your block: 从您的块打印表格:

print drupal_render(drupal_get_form('user_register_form'));

Where parameter is form_id, of course. 当然,其中参数是form_id。

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

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