具有复杂 fAPI 子字段的 Drupal CCK 字段类型

发布于 2024-08-14 02:37:19 字数 974 浏览 4 评论 0原文

这个问题基本上是这个问题的后续问题:

Drupal Custom CCK field具有多个子字段

我需要构建一个存储多条数据的 CCK 字段类型,并且 fAPI 表单元素用于接受已经存在的每条数据的输入。这些元素通过 fAPI #process 函数构建到多个 HTML 表单输入中。问题是,当我尝试在 CCK 字段中使用这些元素时,小部件的输入与 hook_field_settings() 中指定的数据库列不一致。该小部件返回如下内容:

Array (
  [thumbnail_image] =>
    [imceimage_path] => ...
    [imceimage_alt] => ...
    [imceimage_width]  => ...
    [imceimage_height]  => ...
  [user_address] =>
    [address_number] => ...
    [address_street] => ...
    [address_city] => ...
    [address_state] => ...

除非有一种方法可以在 hook_field_settings() 中指定“子列”,否则在我看来,我无法将表单元素类型与 CCK 字段中的子元素一起使用。我尝试使用 CCK 字段验证从 thumbnail_image 中提取“imce_xxx”值,同样使用 user_address 提取“imce_xxx”值,但这对我没有任何帮助。

是否无法在 CCK 字段定义中使用带有子元素的表单元素?

谢谢,
克里夫·史密斯

This question is basically a follow-up to this one:

Drupal Custom CCK field with multiple child fields

I need to build a CCK field type that stores several pieces of data, and fAPI form elements to accept the input for each piece of data already exist. These elements are built out into multiple HTML form inputs with fAPI #process functions. The problem is that when I try to use these elements in my CCK field, the input from the widget doesn't line up with the database columns specified in hook_field_settings(). The widget returns something like this:

Array (
  [thumbnail_image] =>
    [imceimage_path] => ...
    [imceimage_alt] => ...
    [imceimage_width]  => ...
    [imceimage_height]  => ...
  [user_address] =>
    [address_number] => ...
    [address_street] => ...
    [address_city] => ...
    [address_state] => ...

Unless there's a way to specify "sub-columns" in hook_field_settings(), it appears to me that I can't use form element types with sub-elements in CCK fields. I've tried using CCK field validation to pull out the "imce_xxx" values from thumbnail_image and likewise with user_address, but that doesn't get me anywhere.

Is it not possible to use form elements with child elements in CCK field definitions?

Thanks,
Cliff Smith

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

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

发布评论

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

评论(1

挽你眉间 2024-08-21 02:37:19

CCK 3 -dev 版本有一个很好的新功能,称为嵌套字段组。它允许您创建字段组并向其中添加字段。在节点中,您可以添加新的字段组,每个字段组中包含相同的字段集。 Views 3 -dev 允许对这些字段组进行分组和显示。

CCK 3 -dev version has nice new feature called Nested Fieldgroups. It allows you to create fieldgroup and add fields to it. in node you can then add new fieldgroups with same set of fields in each. Views 3 -dev allows to group and display these fieldgroups.

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