Skip to content

Commit

Permalink
ChannelForm: Store cleared default options as empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Jul 15, 2024
1 parent 15cd72b commit 1079dc6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions application/forms/ChannelForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,17 +397,19 @@ protected function fromCurrentLocale(array $localeMap): ?string
*/
private function filterConfig(array $config): array
{
return array_filter(
$config,
function ($configItem, $key) {
if (isset($this->defaultChannelOptions[$key])) {
return $this->defaultChannelOptions[$key] !== $configItem;
foreach ($config as $key => $value) {
if (isset($this->defaultChannelOptions[$key])) {
if ($value === null) {
$config[$key] = '';
} elseif ($this->defaultChannelOptions[$key] === $value) {
unset($config[$key]);
}
} elseif ($value === null) {
unset($config[$key]);
}
}

return $configItem !== null;
},
ARRAY_FILTER_USE_BOTH
);
return $config;
}

/**
Expand Down

0 comments on commit 1079dc6

Please sign in to comment.