PluginInspectionInterface is the way instanciated plugin objects (or code manipulating them) can access their own plugin_id and plugin_definition.
Method names are getPluginId() and getDefinition().
Underlying properties, defined by PluginBase, are $pluginId and $pluginDefinition.

Thus, getDefinition() method is inconsistent in that it lacks a "Plugin" prefix for context.

That's an actual issue with TypedData objects, which are plugins, and have an (unrelated) getDefinition() method of their own in TypedDatainterface. Thus, they currently don't extend PluginBase or implement PluginInspectionInterface - but #1969728: Implement Field API "field types" as TypedData Plugins needs it.

More generally, I think the term "definition" is of too common use to be "stolen" by Plugin API, which , when looking a the API of given plugin-based system, is merely an implementation detail. That's the very reason why getPluginId() was not named getId(), it would not be reasonable to steal the notion of "id".

Opinions, before I try to roll a patch ?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

+1 from me

yched’s picture

Status: Active » Needs review
FileSize
25.64 KB

Patch.

Status: Needs review » Needs work

The last submitted patch, PluginInspectionInterface-getPluginDefinition-1986802-2.patch, failed testing.

yched’s picture

Status: Needs work » Needs review

Cannot reproduce the fail locally.

#2: PluginInspectionInterface-getPluginDefinition-1986802-2.patch queued for re-testing.

yched’s picture

yched’s picture

yched’s picture

[edit: removed my last comment, never mind]

yched’s picture

Status: Needs review » Needs work

The last submitted patch, PluginInspectionInterface-getPluginDefinition-1986802-6bis.patch, failed testing.

tim.plunkett’s picture

+1

yched’s picture

Status: Needs work » Needs review
FileSize
23.71 KB

Reroll, + account for new "image toolkit" plugin type.

FWIW, @EclipseGc verbally +1'ed this in Portland.
RTBC anyone ? :-)

yched’s picture

Reroll for new "action" plugin type.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

RTBC if it comes back green. Thanks @yched.

yched’s picture

As explained in the OP, #1969728: Implement Field API "field types" as TypedData Plugins goes forward and adds a getPluginDefinition() method on TypedData classes.
I.e those get inspectability, without being able officially to implement PluginInspectionInterface, since the method in the interface is getDefinition(), and that method name is already taken in TypedDataInterface.

Works, but would be good to get cleaned up.
Thus, adding the relevant tags.

yched’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +EntityAPI, +Field API NG blocker

The last submitted patch, PluginInspectionInterface-getPluginDefinition-1986802-12.patch, failed testing.

yched’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
24.34 KB

Reroll.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 202fe60 and pushed to 8.x. Thanks!

yched’s picture

Automatically closed -- issue fixed for 2 weeks with no activity.