- Merge request !11Draft: Issue #3273765: Field description overwritten in "Leaflet Map (default)" field widget → (Closed) created by Anybody
This is a regression from 🐛 Field description overwritten with Geometry Validation text Fixed .
GeofieldDefaultWidget overrides the user defined field description in
/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element += [
'#type' => 'textarea',
'#default_value' => $items[$delta]->value ?: NULL,
];
if ($this->getSetting('geometry_validation')) {
$element['#description'] = $this->t('Geometry Validation enabled (valid WKT or Geojson format & values required)');
$element['#element_validate'] = [[get_class($this), 'validateGeofieldGeometryText']];
}
else {
$element['#description'] = $this->t('Geometry Validation disabled (invalid WKT or Geojson format & values will be set as NULL)');
}
return ['value' => $element];
}
with the Geometry validation notice.
Expected would be to keep the user entered description and append the validation text.
Completely removing the field description is a major problem as it breaks core functionality.
Field descriptions are important for UX to tell users how to use the form correctly.
Use a Geofield, add a field description and afterwards select a Geofield widget (in our case we used "Leaflet Map (default)". Go to the content edit form and see the field description is overwritten.
Leaflet widget inherits from the Geofield file.
Append the notice instead of overwriting the user defined #description.
Fixed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.