Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 297136

Make it possible to mark field widgets and formatters deprecated, hide from UI unless in use

$
0
0

Problem/Motivation

Sometimes (certainly in contrib, perhaps in core?) we come up with better widgets and formatters for various fields. Since we can't remove old widgets immediately, it'd be great to be able to deprecate them. There's a "no_ui" annotation for field type plugins, but not for widgets or formatters. It'd be great if you could mark a widget or formatter as deprecated, and then have it disappear from the UI unless it was actively in use for a given form/view mode config.

Proposed resolution

Add smarts about a @deprecated annotation to field widget and formatter plugins.
Change the signature of \Drupal\field_ui\Form\EntityDisplayFormBase::getApplicablePluginOptions() to pass along the current setting.
If a given plugin item was deprecated and not the current setting, remove it from the list.

Quoting @larowlan from Slack:

For BC reasons we could probably wrap that in another method so it became:
'#options' => $this->removeDeprecated($this->getApplicablePluginOptions($field_definition), $display_options),
but given it's a protected method, it would be more efficient to just change the signature.

Remaining tasks

  1. Agree on the approach.
  2. Implement it.
  3. Add tests.
  4. Reviews / refinements / sign-off.
  5. RTBC.
  6. Commit.

User interface changes

TBD. Ideally, deprecated field widget and formatter plugins will disappear from the UI unless they're currently in use.

API changes

TBD.

Data model changes

Release notes snippet

TBD.


Viewing all articles
Browse latest Browse all 297136

Trending Articles



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