The core field_ui module supports a hook to add custom widget settings (hook_field_widget_settings_form). Specifically, the select2widget module uses this to specify several custom widget settings for entity reference fields.

When select2widget is used in conjunction with OG Vocab, these custom widget settings are not shown in the OG Vocab form.

The following patch adds support for showing any custom widget settings form that might exist.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpotter’s picture

Here is the patch being used in Open Atrium. Note: While select2widget was mentioned as an example, this patch is not specific to select2widget but can be used for any widget that has custom settings form.

mpotter’s picture

Status: Active » Needs review
amitaibu’s picture

@mpotter, thanks. Can you attach a screenshot to make it clear what you are trying to achieve.

mpotter’s picture

BTW, this patch just adds the custom widget settings form. The patch in #2242387: Override widget settings with settings entity settings is needed to actually load the custom widget settings into the mock field instance.

But yes, here are some screen shots to show what this patch does. In this case I'm using the select2widget module which implements the hooks in field_ui to add custom settings.

1) In the first image you see how this looks on a normal field via the structure->content types->manage fields (in this case, showing select2widget being used on the OG Audience field).

2) In the second image is the OG Vocab field form WITHOUT the patch.

3) In the third image is the OG Vocab field form WITH the patch in #1.

Notice that in (3) it properly shows the widget settings that are shown for the normal field in (1).

mpotter’s picture

Issue summary: View changes
realityloop’s picture

I was getting errors with the foreach loop added in the 2nd hunk of the patch from #1 when using this with hierarchical select, updated patch fixes the issue