"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

yched’s picture

Component: Code » Plugins
neclimdul’s picture

"ParamaterBag" feels like a weird way to describe it but I had considered using an object for this.

yched’s picture

Well, could definitely be a more targeted subclass of ParameterBag, Symfony does the same in a couple places if I'm not mistaken.

neclimdul’s picture

That'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.

sun’s picture

sun’s picture

Issue summary: View changes

typo