Don't show old fields in a set if they're removed from the definition

This commit is contained in:
Ivo Valchev
2021-02-16 10:38:53 +01:00
committed by Bob den Otter
parent 101d4304bb
commit 2af998d504

View File

@@ -83,7 +83,10 @@ class SetField extends Field implements FieldInterface, FieldParentInterface, Li
{
$fieldsFromDefinition = $this->getFieldsFromDefinition();
return array_merge($fieldsFromDefinition, $this->getDefaultValue(), $this->getValue());
// Values from the database, but not of fields that are no longer in the definition.
$value = array_intersect_key($this->getValue(), $fieldsFromDefinition);
return array_merge($fieldsFromDefinition, $this->getDefaultValue(), $value);
}
private function getFieldsFromDefinition(): array