3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Fix Map form element #required is not enforced #560

This commit is contained in:
Michael Stenta 2022-08-29 09:14:49 -04:00
parent b1cd960a4e
commit a63e8a9683
2 changed files with 6 additions and 1 deletions

View file

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Fix for Autocomplete dropdown not showing in Chrome on Android #552](https://github.com/farmOS/farmOS/issues/552)
- [Uncaught (in promise) TypeError: instance.editAttached is undefined #550](https://github.com/farmOS/farmOS/issues/550)
- [Map form element #required is not enforced #560](https://github.com/farmOS/farmOS/issues/560)
## [2.0.0-beta6] 2022-07-30

View file

@ -85,14 +85,18 @@ class FarmMapInput extends FormElement {
// Add a textarea for the WKT value.
$display_raw_geometry = $element['#display_raw_geometry'];
$element_title = $element['#title'] ?? t('Geometry');
if ($display_raw_geometry) {
$element_title .= ' ' . t('WKT');
}
$element['value'] = [
'#type' => $display_raw_geometry ? 'textarea' : 'hidden',
'#title' => $element_title . ' ' . t('WKT'),
'#title' => $element_title,
'#title_display' => 'invisible',
'#attributes' => [
'data-map-geometry-field' => TRUE,
],
'#disabled' => $element['#disabled'],
'#required' => $element['#required'],
];
// Add default value if provided.