So, PanelsStorage is using tagged services specifically because I had thought there was a problem with plugins implementing interfaces that don't exist causing fatal errors even if the module that defines the plugin manager isn't present. I swear that I encountered this problem, but now I can't reproduce it.
On the one hand this is great, because it means Drupal 8 doesn't have this terribly broken problem that I thought it had!
On the other hand, I totally messed up PanelsStorage. :-/
There isn't really anything wrong with using a tagged service, except that a factory pattern (like plugins) would be a more natural fit to what we're trying to do, and it's an architectural decision with no real reason (ie. a reason actually existing in the real world and not my head). :-)
Ideally, we'd fix this sooner rather than later...
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff.txt | 12.44 KB | dsnopek |
#6 | panels-storage-plugins-2648620-6.patch | 14.69 KB | dsnopek |
|
Comments
Comment #2
dsnopekSo, the question is:
Do we ...
I'm torn. I'd like to do #1 because I'm super embarrassed to have built the API like this for no reason. But if someone else had written this code, I'd very likely be arguing for #2 so we don't get off-track.
Comment #3
tim.plunkettI vote for #1. Page Manager hasn't even used this yet, no one else will have.
Comment #4
dsnopekBarring documentation changes, this is the minimum number of changes to make this work. However, looking at how the Page Manager plugin would look... I'm a little bit unsure about the plugin approach, because we're basically ignoring most of the stuff that plugins do.
Here's how the plugin declaration for the Page Manager plugin would look:
https://gist.github.com/dsnopek/611cea4581b2b4d25156
Notice how the annotation has nothing but the 'id' in it, and how we don't descend of PluginBase (or any base), and we ignore all the configuration stuff.
Maybe tagged services wasn't such a bad idea? :-)
Comment #5
tim.plunkettThis should extend PluginID, and can drop the property
Remember, you can do PanelsStorageInterface::class and PanelsStorage::class :)
And then you can change the annotations from
to
+ * @PanelsStorage("page_manager")
Comment #6
dsnopekSorry, I just can't stop thinking about this issue. :-)
This patch makes the changes recommended by Tim on #5, adds a plugin base class (just in case we want to put something in there later) and updates the documentation.
This should be much closer to being actually committable!
Comment #7
EclipseGc CreditAttribution: EclipseGc commentedPretty
Comment #9
EclipseGc CreditAttribution: EclipseGc commentedOk, I committed this. It's the beginnings of an API we want modules like page_manager to use and since that code's not landed yet, and we want to get this right, I'm paving the way.
Eclipse