Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | og_vocab_support_custom_widget_settings-2503991-6.patch | 1.99 KB | realityloop |
#4 | og_vocab_with_patch.png | 53.66 KB | mpotter |
#4 | og_vocab_without_patch.png | 42.75 KB | mpotter |
#4 | og_vocab_field_form.png | 48.73 KB | mpotter |
#1 | og_vocab_support_custom_widget_settings-2503991-1.patch | 2.14 KB | mpotter |
Comments
Comment #1
mpotter CreditAttribution: mpotter commentedHere 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.
Comment #2
mpotter CreditAttribution: mpotter commentedComment #3
amitaibu@mpotter, thanks. Can you attach a screenshot to make it clear what you are trying to achieve.
Comment #4
mpotter CreditAttribution: mpotter commentedBTW, 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).
Comment #5
mpotter CreditAttribution: mpotter commentedComment #6
realityloopI 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