Problem/Motivation
* Classes for configurable plugins are a special case. They can either declare
* their configuration dependencies using the calculateDependencies() method
* described in the paragraph above, or if they have only static dependencies,
* these can be declared using the 'config_dependencies' annotation key.
This is does not really tell the whole story. The configuration entity has to implement EntityWithPluginCollectionInterface and the plugins can implement ConfigurablePluginInterface. If the config entity implements EntityWithPluginCollectionInterface plugin providers and dependencies declared in the plugin's config_dependencies definition key (this does not have to be an annotation - it can be a derived definition) are added. If the plugin implements ConfigurablePluginInterface then each plugin instance's calculateDependencies() method is called.
Steps to reproduce
Proposed resolution
See #4
Remaining tasks
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-2360647
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:
- 2360647-documentation-in-configdependencymanager
changes, plain diff MR !8757
Comments
Comment #1
alexpottFirst effort to improve this.
Comment #2
jhodgdonUmmm... How does implementing an interface "automatically" do anything?
The rest looks reasonable; not sure if accurate or not.
Comment #3
alexpottHere's how (from
ConfigEntityBase::calculateDependencies())Comment #4
jhodgdonAh. How about something like this then:
Some configuration entities have dependencies from plugins and third-party settings; these dependencies can be collected by \Drupal\Core\Config\Entity\ConfigEntityBase::calculateDependencies(). Entities with third-party settings need to implement \Drupal\Core\Config\Entity\ThirdPartySettingsInterface in order to trigger this generic dependency collection. Entities with plugin dependencies need to implement \Drupal\Core\Entity\EntityWithPluginCollectionInterface; this causes the base calculateDependencies() method to add the plugins' providers as dependencies, as well as dependencies declared in the "config_dependencies" key from the plugins' definitions. In addition, plugins that implement \Drupal\Component\Plugin\ConfigurablePluginInterface can declare additional dependencies using \Drupal\Component\Plugin\ConfigurablePluginInterface::calculateDependencies(), and these will also be collected by the base method.
Comment #5
jhedstromCNW based on #4.
Comment #7
mile23Comment #9
manuel garcia commentedPatch was 2 years old, so It may no longer even make sense but well here it is rerolled.
Comment #18
quietone commented@Manuel Garcia, thank you for rerolling the patch. Did you see the comment in #5 that set this to needs work for comment #4. In other words, this needs more that a reroll.
I read the text of the patch and the suggestion in #4. I think #4 is easier to read and understand. Let's use that.
Comment #21
quietone commentedAdd novice tag
Comment #22
sourabhjainI have updated the changes mentioned in #4. Please review.
Comment #23
smustgrave commented#4 does appear to have been copied over.
RTBC+1
Comment #24
quietone commentedI'm triaging RTBC issues. I re-read the IS and the comments.
My comment in #18 was a simple read of the suggested text, I did not check it for accuracy. In hindsight, that looks like a mistake.
It is a 9 year old comment and it does need to read and checked for accuracy. I did a bit of that by searching for each interface or method referred to in the comment. It turns out that \Drupal\Component\Plugin\ConfigurablePluginInterface no longer exists. It was removed in #3081145: Remove BC layers in the Plugin component.
Setting back to Needs work and removing the novice tag.
Comment #26
quietone commentedConverted to MR and updated the text for a removed interface.
Comment #27
smustgrave commented"Entities with plugin dependencies need to" went right up to that 80 character line haha
Update seems good to me
Comment #32
catchCommitted/pushed to 11.x and cherry-picked back through to 10.3.x, thanks!