Readonly formatter settings validation firing when formatter not selected.

Created on 4 May 2023, over 1 year ago
Updated 10 May 2023, over 1 year ago

Problem/Motivation

We have both Read-only Field Widget and Geocoder modules installed. With both of them installed it is not possible to edit the settings of a read-only field due to the Geocode field format validation firing.

Steps to reproduce

  1. Install both Read-only Field Widget and Geocoder;
  2. Add a Text (plain) field to a content type;
  3. Set the field in Manage form display to use the readonly widget;
  4. Click on the cog icon and try to update the field to have an inline label, after clicking on update an error is displayed;

Due to the Drupal\readonly_field_widget\Plugin\Field\FieldWidget\ReadonlyFieldWidget::settingsForm() method calling all of the settingsForm() methods of the potential formatters this then includes the Geocoder Fields formatter Drupal\geocoder_field\Plugin\Field\GeocodeFormatterBase::settingsForm() which adds an #element_validate for the provider element Drupal\geocoder_field\Plugin\Field\FieldFormatter\GeocodeFormatter::validateProvidersSettingsForm().

I'm not sure what the fix can be here, if you select Geocode as the format then the validation function should check whether you have selected one but this check still happens whether you have selected Geocode as the format or not?

Either Geocoder have to rewrite how their module works or Read-only Field Widget have to add code to explicitly ignore their formatter?

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom altcom_neil

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

Comments & Activities

Production build 0.71.5 2024