Drupal 问题 - 自定义 form_altered 模块

发布于 2024-08-29 06:21:53 字数 456 浏览 2 评论 0原文

本周我已经弄清楚如何修改位置模块中的表单元素 使用 form_alter 和自定义 element hook_elements()需要关于 Drupal $form 值的一些提示

我能够使用 unset 隐藏元素,例如: unset($element['locpick']['user_latitude']);

还使用 drupal_add_css 添加了 css隐藏不需要的组,并更改边距、边框和边框填充

但是,我有几个问题:

  • 如何在字段之间添加额外的文本标题?
  • 如何更改输入字段的长度?
  • 是否可以移动字段或将它们放入表格中?

This week I have figured out how to modify form elements in the location module
using form_alter and the custom element hook_elements() : need some tips on Drupal $form value

I was able to to hide elements using unset eg: unset($element['locpick']['user_latitude']);

Also added css with drupal_add_css to hide unwanted groups, and change margins, borders & padding

However, I have a few questions:

  • how can I add additional text header between fields?
  • how can I change input field length?
  • is it possible to move fields around or put them in a table?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡紫姑娘! 2024-09-05 06:21:53

还使用 drupal_add_css 添加了 css 以隐藏不需要的组

我强烈建议不要这样做。使用 Form API 来控制表单。

Also added css with drupal_add_css to hide unwanted groups

I highly advise against this. Use the Form API proper to control forms.

拥醉 2024-09-05 06:21:53

了解这个:http://api.drupal.org /api/drupal/developer--topics--forms_api_reference.html/6

1:设置两个字段的权重,例如分别为10和12。添加新的“item”字段,权重为11。
2:请参阅顶部链接中的“尺寸”。

learn this: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6

1: set weight of two fields, for example, to 10 and 12. Add new "item" field with weight 11.
2: see "size" in top link.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文