When on the "Manage form display" tab of a content type (/admin/structure/types/manage//form-display), and you add a field group, and specify a CSS ID like "#something" (which is invalid due to the '#' character), and click Update, it will trigger an error in field_group_validate_id().

Currently the call to setError() which is triggering the error is on line 62. However, the setError() method is no longer on the FormBuilderInterface object as the code assumes, but on the FormStateInterface object.

The PHP error:

Error: Call to undefined method Drupal\Core\Form\FormBuilder::setError() in /.../htdocs/modules/contrib/field_group/includes/helpers.inc on line 62 #0 [internal function]: field_group_validate_id(Array, Object(Drupal\Core\Form\FormState), Array)

The result of the PHP error is an HTTP 500 response for the AJAX call, and no error is displayed until you save the form, at which point you get a blank screen with only the message "The website encountered an unexpected error. Please try again later.".

Comments

mossy2100 created an issue. See original summary.

mossy2100’s picture

Issue summary: View changes
chewi3’s picture

Version: 8.x-3.0-beta1 » 8.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new849 bytes

"setError" is now called on form state instead of form builder.

nils.destoop’s picture

Status: Needs review » Fixed

Thx for the patch. Committed it to dev

Status: Fixed » Closed (fixed)

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