The state toggles for the image instance settings seem to be incorrect (in \Drupal\image\Plugin\Field\FieldType\ImageItem::fieldSettingsForm()).

To reproduce:

  1. Install site instance and enable "node", "field_ui" and "image"
  2. Create a new node content type and add a field of type "image" (e.g., field_image) to it.

On the instance settings form for field_image there are options for "Enable Alt field" and "Enable Title field" and below each are the "Alt field required" and "Title field required" options. The second set of "required" options should only appear when their respective "Enable" option is checked, but instead they are always visible.

Solution:

It looks like the '#states' values for the alt/title "required" checkboxes just contain the wrong 'visible' setting. In the case of the form element "alt_field_required" :input[name="instance[settings][alt_field]"] is tested for TRUE, but I believe :input[name="field[settings][alt_field]"] should instead be tested.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rjacobs’s picture

Status: Active » Needs review
FileSize
1.04 KB

Here's a patch.

jhedstrom’s picture

Status: Needs review » Reviewed & tested by the community

Great catch! Manually tested and this indeed fixes the regression.

alexpott’s picture

Priority: Minor » Normal
Status: Reviewed & tested by the community » Fixed

I don't think this is a minor bug. This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed b71d7e6 and pushed to 8.0.x. Thanks!

  • alexpott committed b71d7e6 on 8.0.x
    Issue #2350723 by rjacobs: State toggles for Enable alt/title and...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.