Quantcast
Viewing all articles
Browse latest Browse all 294808

Field formatter settings edit button doesn't show unless there is a settings summary

Problem/Motivation

The logic which decides whether to display the formatter settings edit button currently tests whether there is any settings summary text to display. If so, the summary text and the edit button are displayed.

However, if there is no summary text, the edit button will not be shown, even if settings are available for the formatter. This is a bug; the decision to show the edit-button should depend on whether settings are available.

This matters because hook_field_formatter_settings_form_alter() allows modules to add extra settings to formatters which don't already have settings. Meanwhile, the summary text for the extra settings needs to be set in hook_field_formatter_settings_summary_alter(), but there is no way to guarantee that summary text is being provided by that hook.

The problem isn't obvious when looking just at core. AFAIK most (all?) of the core field formatters which have settings produce a summary message in all cases.

The problem arises because when a contrib module extends a formatter settings, it doesn't always make sense to add any summary text. This is desirable, because when you have several modules enabled which extend formatter settings, the settings summaries can become overcrowded. It might only make sense to add a mesage to the summary when a setting is enabled, but omit a summary message whe disabled.

Proposed Resolution

Refactor buildForm() in core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php so that the edit-button is shown whenever there are formatter settings available.

API changes

None.


Viewing all articles
Browse latest Browse all 294808

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>