Active
Project:
Drupal 8 Blocks Everywhere
Component:
Plugins
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 May 2012 at 02:38 UTC
Updated:
23 May 2012 at 15:27 UTC
"plugin definitions" ("the info array about a given plugin implementation") are mostly used property by property rather than for the array as a whole.
They are currently retrieved through methods or functions, so using a property has to be done in two steps :
$definition = $plugin_type->getPluginDefinition($plugin_id); // or $plugin->getPluginDefinition() with #1540206: Allow self inspection on instantiated plugin objects
$foo = $definition['bar'];
Having the discovery classes return the definition as a (Symfony) ParameterBag would make this much more fluent :
$foo = $plugin_type->getPluginDefinition($plugin_id)->get('bar');
Comments
Comment #1
yched commentedComment #2
neclimdul"ParamaterBag" feels like a weird way to describe it but I had considered using an object for this.
Comment #3
yched commentedWell, could definitely be a more targeted subclass of ParameterBag, Symfony does the same in a couple places if I'm not mistaken.
Comment #4
neclimdulThat's kinda what I was thinking. Its not really on my hit list just yet since what we have works and we can follow up with this change but I generally have good feelings about it.
Comment #7
sunComment #7.0
suntypo