Problem/Motivation

It seems that at some point since #2723893: Merge Webforms "OptionEmailtem" feature into Contact Storage was implemented, the default options/list widget and formatter have become more exclusive in its handled field types. This results in there not being a proper widget or formatter to edit or display the values (see attached screenshots).

Interestingly enough, the field is displayed properly directly after installation, but only as long as the form/display settings of the contact form are not re-saved.

Proposed resolution

Implement hook_field_formatter_info_alter and hook_field_widget_info_alter to re-use the default handlers.

/**
 * Implements hook_field_formatter_info_alter().
 */
function contact_storage_field_formatter_info_alter(&$info) {
  // Let our options_email field type re-use the default list formatter.
  $info['list_default']['field_types'][] = 'contact_storage_options_email';
}

/**
 * Implements hook_field_widget_info_alter().
 */
function contact_storage_field_widget_info_alter(&$info) {
  // Let our options_email field type re-use the default options widget.
  $info['options_select']['field_types'][] = 'contact_storage_options_email';
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ckaotik created an issue. See original summary.

Bambell’s picture

Status: Active » Needs review
FileSize
3.08 KB

Great catch. I added the changes you suggested and added more tests as well (change the form, save it and verify that changes are visible). Reproduced the problem and locally verified that it was fixed as well.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

I know we discussed doing this, not sure how we all missed it.

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

thanks

  • larowlan committed 4a29fbb on 8.x-1.x authored by Bambell
    Issue #2753731 by Bambell, ckaotik: New OptionEmailtem missing widget...

Status: Fixed » Closed (fixed)

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