We did not get the module to work without this small patch.

It tells Drupal for which field types the hidden widget is allowed. And you need to select a widget before you can select a formatter and save the field.

CommentFileSizeAuthor
field_types.patch383 bytesbatje

Comments

batje’s picture

Status: Active » Needs review

needs review

xen’s picture

Title: Field Types not set » Automatically add virtual fields using the hidden widget as default formatter to widget field types
Status: Needs review » Active

This will add the hidden widget as an option to all fields, which I don't think is a good idea (how would any normal field react to using it) or makes sense (normal fields only get their data from a widget).

And I can't see how that patch can work for you, $fields is unset, so the end result should be the same.

The correct solution is to implement hook_field_widget_info_alter() and add your virtual field to the field types of the hidden widget.

However, it's such a common case to only use the hidden widget, so I think it would make sense that virtual_field automatically adds field types which has the hidden widget as default_widget to the supported field types, eliminating the need to implement hook_field_widget_info_alter() in the field module, so I'm changing this issue.

xen’s picture

Status: Active » Fixed

Committed a patch that allows virtual fields to specify add_widget in the options, in order to not have to implement hook_widget_info_alter() to get the hidden widget.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.