Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix hook in plugin manager #3219

Closed
wants to merge 2 commits into from

2 participants

Michaël Gallego Matthew Weier O'Phinney
Michaël Gallego

This fix is needed in order for the new approach to create elements to work. Basically, the init function was called correctly when creating element through factory, but was not otherwise (for instance, when you simply pull an invokable form from service manager).

Maybe this could be moved in AbstractPluginManager for every class that implements InitializableInterface.

Deleted user Unknown referenced this pull request from a commit
Matthew Weier O'Phinney weierophinney Merge branch 'hotfix/3219' into develop
Close #3219
c4f5bc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 13, 2012
  1. Michaël Gallego

    Fix hook in plugin manager

    bakura10 authored
  2. Michaël Gallego
This page is out of date. Refresh to see the latest.
6 library/Zend/Form/Factory.php
View
@@ -16,7 +16,6 @@
use Zend\InputFilter\InputFilterInterface;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\Hydrator;
-use Zend\Stdlib\InitializableInterface;
/**
* @category Zend
@@ -217,11 +216,6 @@ public function configureElement(ElementInterface $element, $spec)
$element->setAttributes($attributes);
}
- // Hook to perform stuff, once all the configuration work has been done
- if ($element instanceof InitializableInterface) {
- $element->init();
- }
-
return $element;
}
6 library/Zend/Form/FormElementManager.php
View
@@ -12,6 +12,7 @@
use Zend\ServiceManager\AbstractPluginManager;
use Zend\ServiceManager\ConfigInterface;
+use Zend\Stdlib\InitializableInterface;
/**
* Plugin manager implementation for form elements.
@@ -102,6 +103,11 @@ public function injectFactory($element)
*/
public function validatePlugin($plugin)
{
+ // Hook to perform various initialization, when the element is not created through the factory
+ if ($plugin instanceof InitializableInterface) {
+ $plugin->init();
+ }
+
if ($plugin instanceof ElementInterface) {
return; // we're okay
}
Something went wrong with that request. Please try again.