Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Cant unset Location #36

Open
ivoba opened this issue Jan 10, 2019 · 6 comments
Open

Cant unset Location #36

ivoba opened this issue Jan 10, 2019 · 6 comments

Comments

@ivoba
Copy link

ivoba commented Jan 10, 2019

It seems unsetting a Location or having null values is not possible since the default values are always written to DataObject.

So this is a mandatory field and its not possible to have this optional.
How can we make this field optional resp. having null values in Location?

@willmorgan
Copy link
Member

It's been a long time since I've worked on this project, but maybe this snippet has a hint on how to resolve?

protected function recordFieldData($name) {
$fieldName = $this->childFieldName($name);
return $this->data->$fieldName ?: $this->getDefaultValue($name);
}
public function getDefaultValue($name) {
$fieldValues = $this->getOption('default_field_values');
return isset($fieldValues[$name]) ? $fieldValues[$name] : null;
}

Maybe set default_field_values to their respective null values?

@ivoba
Copy link
Author

ivoba commented Jan 10, 2019

@willmorgan Unfortunatly null translates to lat: 0, lon: 0 which is a valid geo value.

Would be great if one could delete the marker on the map and then value is set to null.
Probably some javascript adjustments. Maybe i find something...

@dhensby
Copy link
Member

dhensby commented Jan 10, 2019

Yeah, probably need a clear value button to unset the marker

@ivoba
Copy link
Author

ivoba commented Jan 10, 2019

Or just not set the marker by default, just center the map with the given default values.
To have a Location one needs to create a marker with a doubleclick.

@dhensby
Copy link
Member

dhensby commented Feb 6, 2019

How do you show the current location if you don't have a marker on load?

@ivoba
Copy link
Author

ivoba commented Feb 6, 2019

If Location is not null resp. Location is already set then there should be a marker on load.
Just if Location is null there shouldnt be a marker.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants