Closed (fixed)
Project:
Drupal core
Version:
8.6.x-dev
Component:
plugin system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
27 Jan 2018 at 01:02 UTC
Updated:
8 May 2018 at 21:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
larowlanComment #3
tim.plunkettClarifying that the method should also be protected
Comment #4
ioana apetri commentedComment #5
ioana apetri commentedHere are the modifications, Please review.
Thanks:)
Comment #7
tim.plunkettThis new method must not alter the state of the object. So it cannot use addDependencies.
I think the method needs to start with a $dependencies variable, and then use
\Drupal\Component\Utility\NestedArray::mergeDeep()to make subsequent additions. And then return it at the end.Comment #8
tim.plunkettThis is what I was describing.
Comment #9
jibranDone.
No interdiff because I started from scratch.
Comment #10
jibranX-post :/. Please ignore my patch. Re-uploading #8.
Comment #11
alexpottI think we need a test that the new getPluginDependencies() method does not alter the state of the object. And I wonder if we should have any BC concerns with adding a method to this trait.
Comment #12
tim.plunkettIf a class uses that trait and already has a getPluginDependencies(), the new addition to the trait will be ignored and the original method will still be used.
Any recommendations on testing the object state? Off the top of my head I can only think of using Reflection.
Comment #13
alexpottWould it work if the test used the trait like a normal class and then the test would have the property from the trait to test against?
Comment #14
tim.plunkettAdded a test.
Comment #15
jibranThanks, test looks good.
Comment #16
eclipsegc commentedThis totally empowers the plugin dependency calculation much better than current and removes a ton of custom code that shouldn't be specific to LayoutBuilder so, I'd say RTBC on this. Tests look good, patch looks good.
Eclipse
Comment #17
larowlanCan we use this in Workflows module too?
Comment #18
tim.plunkettThis issue is a step on the way to fixing #2579743: Config entities implementing EntityWithPluginCollectionInterface should ask the plugins to react when their dependencies are removed. Both LB and Workflows have @todo's pointing to that issue.
Comment #19
alexpottCommitted 3988196 and pushed to 8.6.x. Thanks!
Comment #22
tim.plunkettThis blocks #2943627: Layout Builder does not consult layout plugin for dependencies going in to 8.5.x
Comment #24
tim.plunkettNot sure why it didn't apply, but this patch was generated by cherry-picking the 8.6.x commit.
Also, in case this does not make it into 8.5.x, I updated the blocked issue to work around it...
Comment #25
tim.plunkettPer #2943627-43: Layout Builder does not consult layout plugin for dependencies, not going to backport this one.
Comment #27
jwilson3There is a line of code added in the patch here that is needed in Drupal 8.5, because NestedArray is present in Drupal 8.5.x PluginDependencyTrait.php but is missing ausenamespace. (Discovered while testing a backport of #2904550: PluginDependencyTrait::calculatePluginDependencies() does not handle theme provided plugins).Ignore me. Appologies, the NestedArray does NOT exist in D8.5.x without the patch on the ticket I was backporting.