When a form returns a formstate error the following notice is returned.
Notice: Undefined index: #parents in Drupal\Core\Form\FormState->getError() (line 1112 of core/lib/Drupal/Core/Form/FormState.php).
Drupal\Core\Form\FormState->getError(Array) (Line: 160)
Drupal\Core\Form\FormErrorHandler->setElementErrorsFromFormState(Array, Object, Array) (Line: 120)
Drupal\Core\Form\FormErrorHandler->setElementErrorsFromFormState(Array, Object, Array) (Line: 120)
Drupal\Core\Form\FormErrorHandler->setElementErrorsFromFormState(Array, Object, Array) (Line: 120)
Drupal\Core\Form\FormErrorHandler->setElementErrorsFromFormState(Array, Object, Array) (Line: 120)
Drupal\Core\Form\FormErrorHandler->setElementErrorsFromFormState(Array, Object) (Line: 23)
Drupal\Core\Form\FormErrorHandler->handleFormErrors(Array, Object) (Line: 202)
I did some quick research and found that it has to do with the following lines within the class GeofieldMap under Drupal\geofield_map\Element
// Geoaddress Field Settings.
$complete_form[$element['#geoaddress_field']['field']]['widget'][0]['value']['#description'] = (string) t('This value will be synchronized with the Geofield Map Reverse-Geocoded value.');
if ($element['#geoaddress_field']['hidden']) {
$complete_form[$element['#geoaddress_field']['field']]['#attributes']['class'][] = 'geofield_map_geoaddress_field_hidden';
}
if ($element['#geoaddress_field']['disabled']) {
$complete_form[$element['#geoaddress_field']['field']]['widget'][0]['value']['#attributes']['readonly'] = 'readonly';
$complete_form[$element['#geoaddress_field']['field']]['widget'][0]['value']['#description'] = (string) t('This field is readonly. It will be synchronized with the Geofield Map Reverse-Geocoded value.');
}
// Ensure the geoaddress_field has got an #id, otherwise generate it.
if (!isset($complete_form[$element['#geoaddress_field']['field']]['widget'][0]['value']['#id'])) {
$complete_form[$element['#geoaddress_field']['field']]['widget'][0]['value']['#id'] = $element['#geoaddress_field']['field'] . '-0';
}
Comments
Comment #2
itamair commentedTnx @IJsbrandy ... I was unable to recreate the error message, but probably found the matter.
Check if the attached patch solves your issue, and confirm it, please, so that II will commit it in the dev branch.
Comment #3
itamair commentedComment #4
itamair commentedComment #6
itamair commentedComment #7
ijsbrandy commentedThank you @itamair it fixes the issue!
Comment #8
itamair commented