I'm looking to see if there's a particular reason why invocation of the getFormElementManager doesn't pass options if $spec contains options key and Factory waits until after object initializes to configure form. Other parts of the repo extending AbstractPluginManager pass options if available, seems only here this is omitted and prevents parts of my form construct or init to load. Adding $spec['options'] ?? null works. Any insight would be greatly appreciated.
public function create($spec)
{
$spec = $this->validateSpecification($spec, __METHOD__);
$type = isset($spec['type']) ? $spec['type'] : Element::class;
$element = $this->getFormElementManager()->get($type, $spec['options'] ?? null);
if ($element instanceof FormInterface) {
return $this->configureForm($element, $spec);
}
if ($element instanceof FieldsetInterface) {
return $this->configureFieldset($element, $spec);
}
if ($element instanceof ElementInterface) {
return $this->configureElement($element, $spec);
}
throw new Exception\DomainException(sprintf(
'%s expects the $spec["type"] to implement one of %s, %s, or %s; received %s',
__METHOD__,
ElementInterface::class,
FieldsetInterface::class,
FormInterface::class,
$type
));
}
I'm looking to see if there's a particular reason why invocation of the getFormElementManager doesn't pass options if $spec contains options key and Factory waits until after object initializes to configure form. Other parts of the repo extending AbstractPluginManager pass options if available, seems only here this is omitted and prevents parts of my form construct or init to load. Adding
$spec['options'] ?? null
works. Any insight would be greatly appreciated.Original block:
https://github.com/zendframework/zend-form/blob/4419eef6dbe9d276e7e27c6a25f022be74534959/src/Factory.php#L117