plugin field widget looks broken when there's only one plugin available

Created on 8 January 2019, about 6 years ago
Updated 29 January 2025, 26 days ago

When there is only one plugin of the type used by the field, the field widget just shows the field label and nothing else. This looks completely broken.

Poking at the code, it looks like what's going on is that the widget sets a value, which doesn't output in the form:

    $element['select']['container']['plugin_id'] = array(
      '#type' => 'value',
      '#value' => $this->getSelectedPlugin()->getPluginId(),
    );

This is bad on two counts:

a) it's really bad UX to show something that looks broken. If there is only one option that must be selected, show it and disable the form element
b) it's NOT the only option anyway, as if the field is not required the user could select nothing.

🐛 Bug report
Status

Needs work

Version

2.0

Component

User interface

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024