public function FieldMapEnhancer::enhance in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony-cmf/routing/Enhancer/FieldMapEnhancer.php \Symfony\Cmf\Component\Routing\Enhancer\FieldMapEnhancer::enhance()
If the target field is not set but the source field is, map the field
Overrides RouteEnhancerInterface::enhance
File
- vendor/
symfony-cmf/ routing/ Enhancer/ FieldMapEnhancer.php, line 54
Class
- FieldMapEnhancer
- This enhancer can fill one field with the result of a hashmap lookup of another field. If the target field is already set, it does nothing.
Namespace
Symfony\Cmf\Component\Routing\EnhancerCode
public function enhance(array $defaults, Request $request) {
if (isset($defaults[$this->target])) {
return $defaults;
}
if (!isset($defaults[$this->source])) {
return $defaults;
}
if (!isset($this->hashmap[$defaults[$this->source]])) {
return $defaults;
}
$defaults[$this->target] = $this->hashmap[$defaults[$this->source]];
return $defaults;
}