-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #2504031: Fix __construct of plugin to be compatible with D8 Plugins #51
Issue #2504031: Fix __construct of plugin to be compatible with D8 Plugins #51
Conversation
'arguments' => array() | ||
); | ||
|
||
array_unshift($service_definition['arguments'], $configuration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move all of this into the caller (ContainerAwarePluginManager::createInstance)
Mh I think its odd to expose the plugin information on a container |
@@ -61,8 +61,7 @@ public function hasDefinition($plugin_id) { | |||
public function createInstance($plugin_id, array $configuration = array()) { | |||
// @todo: Use ->expandArguments() when get() disallows getting private | |||
// services. | |||
$plugin = clone $this->container->get($this->servicePrefix . $plugin_id); | |||
return $plugin; | |||
return $this->container->createInstance($this->servicePrefix . $plugin_id, $configuration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this with the $definition instead, get the definition via: $this->getDefinition($plugin_id);
Can't get this working. |
@@ -218,6 +218,8 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) { | |||
$this->services[$id] = $service; | |||
} | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
white space change
@dawehner: It is, the definitions should be parameters per plugin manager. (and yes I want that info in the container for now for those plugin managers). This is a first step into that direction, createInstance is only temporary. I think the real fix is to have get() also take a definition array. |
@drupol The code is great. The unit tests fail, because of changed expectations. I will fix them - likely tomorrow. |
Ok, I will look for it in the meantime ! Thanks for your patience :) |
If it helps, when I try to run Openlayers with these changes, I get the error:
|
|
||
array_unshift($plugin_definition['arguments'], $configuration); | ||
|
||
return $this->container->createInstance($this->servicePrefix . $plugin_id, $configuration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOH!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the bug now, need to pass $plugin_definition and not $configuration here ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drupol ^^
Now I don't have any errors and it seems that it has fixed a couple of things. BUT... I have now plenty of:
I will look for them at home. |
@drupol Yes, that is the BC break I talked about. We should break BC some more before you fix it ;). |
No problem :) |
To break BC some more we should use:
As the first parameters. That means array_unshift the plugin_id first and then the configuration. Great work! |
It works if I do some change in the constructor of my OL objects:
But $configuration is always empty. |
Actually, I can now remove the constructor method from Objects.php ! 👍 |
@drupol We will need a huge change notice both for service_container and openlayers. I will also have to fix render_cache first. |
Huge ? |
Triggering a rebuild. |
…lugins-to-be-compatible-with-Drupal-8 Issue #2504031: Fix __construct of plugins to be compatible with Drupal 8 and take the necessary configuration
Update code to be compatible with D8.