Do not apply options which value is null

This commit is contained in:
David Molineus
2020-01-03 08:43:21 +01:00
parent 70b7d0ab9c
commit 711b06c6d3
2 changed files with 13 additions and 1 deletions

View File

@@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Do not add options which value is `NULL`
## [3.1.5] - 2019-08-26 ## [3.1.5] - 2019-08-26
### Fixed ### Fixed
@@ -130,7 +136,9 @@ Implemented enhancements
- Bypass filesystem cache in debug mode - Bypass filesystem cache in debug mode
- Changelog added - Changelog added
[3.1.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.4 [Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.5...hotfix/3.1.6
[3.1.5]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.4...3.1.5
[3.1.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.3...3.1.4
[3.1.3]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.3 [3.1.3]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.3
[3.1.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.0...3.1.1 [3.1.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.0...3.1.1
[3.0.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.3...3.0.4 [3.0.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.3...3.0.4

View File

@@ -210,6 +210,10 @@ class OptionsBuilder
foreach ($options as $option => $mapping) { foreach ($options as $option => $mapping) {
$default = static::getDefaultOption($option, $definition); $default = static::getDefaultOption($option, $definition);
if ($model->$mapping === null) {
continue;
}
if ($model->$mapping === '1' || $model->$mapping === '') { if ($model->$mapping === '1' || $model->$mapping === '') {
if (((bool) $model->$mapping) !== $default) { if (((bool) $model->$mapping) !== $default) {
static::applyOption($option, $model->$mapping, $definition); static::applyOption($option, $model->$mapping, $definition);