Closed (fixed)
Project:
Diff
Version:
8.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Task
Assigned:
Reporter:
Created:
22 Aug 2016 at 16:30 UTC
Updated:
13 Sep 2016 at 13:54 UTC
Jump to comment: Most recent, Most recent file
In #2785147: [META] Introduce a DiffLayout plugin system we are adding a new LayoutPlugin System. thus we need to convert first the classic theme to a layout plugin.
Create the plugin manager, schema and remaining things to make the classic theme be a layout plugin.
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | interdiff-2788153-31-33.txt | 3.46 KB | johnchque |
| #33 | convert_default_theme-2788153-33.patch | 57.16 KB | johnchque |
| #31 | convert_default_theme-2788153-31.patch | 57.13 KB | johnchque |
| #31 | interdiff-2788153-26-31.txt | 28.91 KB | johnchque |
| #26 | diff_2788153_plugin_26.patch | 42.14 KB | miro_dietiker |
Comments
Comment #2
johnchqueThis should be the first step.
Comment #3
miro_dietikerNot sure how much sense it makes to commit this separately. Without the plugins, without actually doing anything.
So the granularity of small issues still need the full scope of
- offering some functionality
- including test coverage
Whileas you should trimm down the meta issue for the layout plugins to the absolute minimum for a first commit and add more functionality in follow-ups.
So the first sub-issue will still be quite some monster...
Comment #4
johnchqueThen this gonna change.
Comment #5
johnchqueStill working on this.
Comment #6
johnchqueEarly patch, seems to break the diff comparison, will investigate more.
Comment #8
johnchquemade extra changes. Still the code seems dirty.
Comment #10
johnchqueSetting as needs review for feedback.
Comment #11
johnchqueAlso, not really sure if we should add a table in the settings form to sort the plugins.
Comment #12
miro_dietikerSome first review here...
The $filter is what should specify the plugin to load.
Yeah, for now simply an enable checkbox. And yeah, some label for the overview.
I'm not 100% sure we should pass in $route_match that deep.
I think it should be $entity instead of $route_match in the plugin.
I think this should be added by the caller already to have the basic CSS for the header also ready independent of plugin.
This (navigation and route handling) would not go into the layout plugin.
Also i would keep this at the Generic/PluginRevisionController
Markdown is a second item in the dropdown. Thus i would make it a separate plugin.
Comment #13
johnchqueMade some other changes, I just added the markdown plugin. That makes me wonder if the applyMarkdown made in DiffEntityComparison should be done directly in the plugin. So the other plugins can get a cleaner array to do the loop.
Comment #15
johnchqueLet's see if this works. :)
Comment #17
johnchqueMade some other changes to fix tests.
Comment #18
johnchqueAdding complexity with no reason, now should be better.
Comment #19
johnchqueMade some other changes, now the array returned by diffEntityComparison is much cleaner and every plugin does their own job. :)
Comment #21
johnchqueLife could be much harder without tests. :)
Comment #22
johnchquebtw the last patch was built over #2789437: Move filter dropdown above the table
Comment #23
johnchqueShould we add weight to the plugins? Would be nice to have them sorted. :)
Comment #24
miro_dietikerThis looks really awesome!
Yeah sure we need a weight to order appearance in the drop down button.
I guess the highest prio will then simply be the default.. or should we stay with current definition?
Is this common in controllers? Can't remember this is widely done.
Hmm, i think the idea was to have a config (file) per plugin. So modules could easily provide new diffs incl default config.
But no more sure. ;-)
I like how you convert the markdown special cases!
Finally, i can't see the settings used.
The setting need not only weight, but also "enabled" or "status" key tho disable / enable a plugin.
EDIT: Lots of statements and questions removed as i found out they have been wrong or i found the answer. ;-)
Comment #25
miro_dietikerAlso promoting this. Hope we can get this in ASAP and then do remaining things in follow-ups if needed.
Comment #26
miro_dietikerProviding a reroll.
Comment #27
miro_dietikerSo yeah, i guess the most important thing to decide now is if we stay with the proposed config storage, or if we do one config per plugin.
Comment #28
berdirI'm not sure about config entities or not. introducing a config entity is going to make this patch quite a bit bigger, although you could postpoine the UI to a later phase, and just require the config entity to be created by the module. core does that in a similar way with action plugins.. and it is rather confusing there, since plugins without config entity are not picked up.
So the question, as discussed with Miro already, is there a possible use case where the same plugin would be used multiple times, with different config? If so, use config entities, if not, then don't. it would also make updating a lot more complicated, only alpha, but you'd probably have to add a update function, as it would be completely broken without the config entities.
one more thing is the config schema, apparently some markdown setting is in the base schema, that's wrong, should be in a markdown specific one.
if we move everything around, should we clean this up a bit and use proper naming like getRevisionIds() or so?
should we check if this filter exists before using it, to avoid exceptions?
does this maybe belong in the plugin? other plugins might want different libraries?
missing/incomplete docs and more $vid stuff (vid is node specific)
are we sure that this is not something that a plugin might want to do differently?
if not, then why do we need to pass the $build array to the plugins? can't we just merge things together?
order seems strange, with parent construct in the middle, that is usually first.
no need for a todo, either keep it empty, if you consider that having configuration is a special case and most need it, or remove some/all methods to force plugins to implement it.
those should be implemented, just set/return property?
why no cache and alter hook like 99% of the other plugin managers?
ah, I see, because the existing one also doesn't have caching/alter. Bad example, that should be fixed. look at core examples.
Plugin/Layout is also a really bad namespace. That's guaranteed to conflict on core or some other contrib module.
Usually, namespaces are two folders, Diff is already a really bad example again. Standard is module_name/something, so diff/layout and diff/builder or something like that would be much better.
if plugins don't have to set anything except the diff key, then I would let them return just this part, this can also have attached. and no $build argument then as mentioned above.
is this really plugin specific? shouldn't it go the baes class at least?
Comment #29
berdirOne more thing. It looks like the new plugin controller class replaces the previous generic one, but the old one is not removed, which means it is all new code and the new one is also only used for nodes I think as that extends from that now.
Comment #30
miro_dietikerThx for review, Berdir!
I was about to commit this as a first step, but i think many of the review items should be implemented here.
Let's still keep the issue minimal and push larger things into followups - create them as issues. I'm pretty sure we will progress faster.
Comment #31
johnchqueRemoved the generic revision controller since is not used anymore. Fixed code based on comments above.
Some thoughts:
About 28.3 28.4 I think we want to maintain the revision navigation based on the controller. But we can always move it. Or we can move it to the base class?
About 28.8 in the construct the first parameter is a sub-folder. I've been looking for examples and most of the time it is used with Plugins/something.
About 28.10 Not really sure if that should go to the controller or base class.
Comment #32
miro_dietikerAlmost ready for commit... Still some last minute feedback.
'classic' OK, but why repeat "layout" if all are?
Same for markdown_layout.
The problem here is we already have a plugin namespace "Plugin/Diff" that is for Diff field plugins.
Don't forget, this is a global discovery. There is a layout module and this namespace reads like we are globally introducing a layout system.
No it's about diff, thus we should name plugins better:
- Plugin/diff/Layout
- Plugin/diff/Field
The problem with the second rename is we break existing plugins such as ERR... But we didn't commit to a stable API yet and i don't know about others that picked this up. Still we need the related issues ready to commit.
If we want to rename the Plugin/Diff namespace, we should do it as a separate issue.
#2791943: Rename Plugin/Diff to Plugin/diff/Field
Comment #33
johnchqueTrue, better to let the namespaces be clear and clean, made those changes. :)
Comment #35
miro_dietikerYeah that's awesome.
Tested a bit manually and i'm satisfied.
Committing to allow us move forward in smaller steps with follow-ups.
Still back to needs work until all follow-ups are created.
Comment #36
johnchqueAdded related issues.