The example implementations of the hook_field_formatter_settings_* hooks (in field_ui.api.php) include conditions which check the field type.

I think it would be more appropriate if these examples used a check for the formatter type. The reasons for this are:

  • The additional settings apply specifically to field formatters (not fields as such), but
  • A field type can have more than one type of formatter, and
  • Some field formatters can be used for more than one type of field.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andrewmacpherson’s picture

Status: Active » Needs review
FileSize
1.38 KB
andrewmacpherson’s picture

Minor correction to the previous patch; method call brackets were missing.

This one uses correct getPluginId()

swentel’s picture

Status: Needs review » Reviewed & tested by the community

Good!

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch and review! Definitely a better example. Committed to 8.x.

If you think we should port this to 7.x, please set the issue version/status appropriately and do so. Thanks!

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