Issue #3398982 by Wim Leers, phenaproxima, alexpott, borisson_: ConfigFormBase...
Issue #3398982 by Wim Leers, phenaproxima, alexpott, borisson_: ConfigFormBase + validation constraints: support non-1:1 form element-to-config property mapping again
(cherry picked from commit 42194279)
thrownew\InvalidArgumentException(sprintf('Config target is associated with %s but %s given.',$this->configName,$config->getName()));
}
$is_multi_target=$this->isMultiTarget();
if($this->toConfig){
$value=($this->toConfig)($value,$form_state);
if($is_multi_target){
// If we're targeting multiple property paths, $value needs to be an array
// with every targeted property path.
if(!is_array($value)){
thrownew\LogicException(sprintf('The toConfig callable returned a %s, but it must be an array with a key-value pair for each of the targeted property paths.',gettype($value)));
thrownew\LogicException(sprintf('The toConfig callable returned an array that is missing key-value pairs for the following targeted property paths: %s.',implode(', ',$missing_keys)));
thrownew\LogicException(sprintf('The toConfig callable returned an array that contains key-value pairs that do not match targeted property paths: %s.',implode(', ',$unknown_keys)));
}
}
}
// Match the structure expected for a multi-target ConfigTarget.
if(!$is_multi_target){
$value=[$this->propertyPaths[0]=>$value];
}
// Set the returned value, or if a special value (one of the cases in the
// ConfigTargetValue enum): apply the appropriate action.