Fix Notice: Undefined index: #default_value

This commit is contained in:
Michael Stenta 2022-06-15 16:51:49 -04:00
parent 6e6c96eeef
commit 0516346d23
1 changed files with 2 additions and 1 deletions

View File

@ -35,6 +35,7 @@ class FarmMapWkt extends FormElement {
// Display descriptions above the map by default. // Display descriptions above the map by default.
'#description_display' => 'before', '#description_display' => 'before',
'#map_type' => 'geofield_widget', '#map_type' => 'geofield_widget',
'#default_value' => '',
'#display_raw_geometry' => TRUE, '#display_raw_geometry' => TRUE,
]; ];
} }
@ -97,7 +98,7 @@ class FarmMapWkt extends FormElement {
*/ */
public static function valueCallback(&$element, $input, FormStateInterface $form_state) { public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
if ($input === FALSE) { if ($input === FALSE) {
return $element['#default_value'] ?: []; return $element['#default_value'] ?: '';
} }
if ($input['value']) { if ($input['value']) {