API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Plug...

Make following the pathway of plugin construction clearer if the parameters were explained with this in mind:

- $configuration is the configuration array that is passed to the plugin manager's createInstance() method

Also adds a link to the direct plugin definition API docs.

Follow up issue: #3627409: Explain the extra items that are passed to PluginBase::__construct() in the $plugin_definition array besides the plugin configuration

Issue fork drupal-2079245

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jhodgdon’s picture

Great idea!!!!!!!!!!

joachim’s picture

Issue summary: View changes

unsure about 'provider'

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
larowlan’s picture

Priority: Normal » Minor
Issue summary: View changes
Issue tags: +Bug Smash Initiative, +Novice

Yes provider is the module

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

royalpinto007 made their first commit to this issue’s fork.

royalpinto007’s picture

Assigned: Unassigned » royalpinto007

royalpinto007’s picture

Status: Active » Needs review
joachim’s picture

Status: Needs review » Needs work

Thanks for the MR. Needs a little bit of work.

royalpinto007’s picture

Sure, I will make the required changes.

royalpinto007’s picture

Assigned: royalpinto007 » Unassigned

Thank you for reviewing and identifying the mistakes in the parameter definition. I have now updated the definition to fix those mistakes. I appreciate your help in making this better!

Quite unsure about the YAML plugins, can be added to the MR later on.

royalpinto007’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

MR has a valid failure it seems.

royalpinto007’s picture

Assigned: Unassigned » royalpinto007
royalpinto007’s picture

Assigned: royalpinto007 » Unassigned
Status: Needs work » Needs review
royalpinto007’s picture

Status: Needs review » Needs work

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

xjm’s picture

Status: Needs work » Active

The Drupal Contribution Mentoring team is triaging issues for DrupalCon Rotterdam 2026, and we are reserving this issue for Mentored Contribution during the event.

After October 3, this issue returns to being open to all. Thanks!

The merge request here was closed for being very old, but the documentation addition is still relevant as far as I can tell. The diff from the old merge request does not apply, but a new merge request could be created with these documentation additions on the class constructor for
core/lib/Drupal/Component/Plugin/PluginBase.php:

    * @param array $configuration
    *   A configuration array containing information about the plugin instance.
+   *   If the plugin is being created by calling
+   *   \Drupal\Core\Plugin\DefaultPluginManager::createInstance(),
+   *   this is the configuration array passed to that method.
    * @param string $plugin_id
    *   The plugin_id for the plugin instance.
    * @param mixed $plugin_definition
    *   The plugin implementation definition.
+   *   In the case of plugins using annotation discovery,
+   *   this is the data from the annotation on the plugin class.

So, the novice task for this issue would be to edit core/lib/Drupal/Component/Plugin/PluginBase.php to add the above helpful documentation, and then create a new branch in the issue fork for those changes.

Setting active since there is no relevant merge request at the moment. Thanks everyone!

joachim’s picture

The MR's branch could probably be rebased. As it's docs, I don't image that much has changed.

xjm’s picture

Honestly I recommend just manually adding the changes over trying to rebase across so many branches; the changeset is so small. The lines need reformatting anyway to wrap properly (starting on the same line as the existing docblock, rather than a separate line).

xjm’s picture

Issue tags: +Rotterdam2026
griff phillips’s picture

Working on this item at Drupalcon Rotterdam 2026 today with mentor ekes

kristiantosney’s picture

I am at DrupalCon Rotterdam 2026, today I will be working on this issues. My mentor is Ekes.

kristof de weyer’s picture

I am at DrupalCon Rotterdam 2026, today I will be working on this issues. My mentor is Ekes.

griff phillips’s picture

I have pushed branch 2079245-explain-the-extra-12.0.x which contains these documentation changes. Leaving now - other contributors can take over.

kristiantosney’s picture

Status: Active » Needs review

Merge request with updated argument description can be found here: https://git.drupalcode.org/project/drupal/-/merge_requests/17304

ekes made their first commit to this issue’s fork.

ekes changed the visibility of the branch 2079245-explain-the-extra-12.0.x to hidden.

kristof de weyer’s picture

We worked on it and fixed the comment and changed the calling function to \Drupal\Component\Plugin\Factory\FactoryInterface::createInstance() so it does not reference core anymore as that is not allowed.
the replacement was found with the help of an LLM and reviewed to be correct.

xjm’s picture

Title: explain the extra items that are passed to PluginBase::__construct() in $plugin_definition » Explain the extra items that are passed to PluginBase::__construct() in $plugin_definition
Issue tags: +Needs subsystem maintainer review

Great work on this everyone!

Now that it is Needs review, the next step is for a more experienced member of our community to RTBC it. In this case, a subsystem maintainers's feedback would be good to ensure the info is correct after all this time (I think it is, but want to be sure).

Tagging for subsystem maintainer review and I'll look for one of them since they're here. 😉

joachim’s picture

These points haven't been covered:

> - class: the class of the plugin
> - provider: the module where the plugin is defined? or the module that defines the plugin type?

xjm’s picture

Status: Needs review » Needs work
Issue tags: -Needs subsystem maintainer review +Needs followup

@joachim, since this is an issue for contribution day and first-time contributors, let's create a separate followup issue.

NW for @timplunkett's feedback. Thanks!

ekes’s picture

Status: Needs work » Reviewed & tested by the community
aurora-norris’s picture

Issue summary: View changes
xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs followup
xjm’s picture

Status: Needs work » Reviewed & tested by the community
xjm’s picture

Title: Explain the extra items that are passed to PluginBase::__construct() in $plugin_definition » Provide better explanation of plugin configuration array for the constructor, and reference plugin API docs
xjm’s picture

Title: Provide better explanation of plugin configuration array for the constructor, and reference plugin API docs » Provide better explanation of plugin configuration array for the PluginBase constructor, and reference plugin API docs
xjm’s picture

Category: Bug report » Task

  • xjm committed a19dfee8 on main
    task: #2079245 Provide better explanation of plugin configuration array...

  • xjm committed 2509cbe2 on 12.0.x
    task: #2079245 Provide better explanation of plugin configuration array...

  • xjm committed 66d76145 on 11.x
    task: #2079245 Provide better explanation of plugin configuration array...

  • xjm committed 3ecdc936 on 11.4.x
    task: #2079245 Provide better explanation of plugin configuration array...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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