Select all if empty

Categories

Component ID

2823729

Component name

Select all if empty

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

240

Component created

Component changed

Component body

Handle empty fields with an options-based widget as if all options were selected.

Say an entity has a field with a list of countries which controls in which country the entity is available. If no country is selected I would like it to be displayed in every country. This way I save space in the database and enhance the UX of the entity form.

There are many ways to solve this, this module does the following:

  1. Adds a setting to all field instances that have a widget from the core options module. If this setting is enabled, an empty field value will be replaced by all the options upon entity load.
  2. The same setting will remove all field values from the entity when saving it if all options were selected.
  3. Another field instance setting will display the field as empty on the entity form.

Translatable and multicolumn fields are not supported, patches are welcome.