Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce
1. install standard 8.x
2. edit frontpage view
You see "Show: Missing style plugin | Missing style plugin". It should be "Show: Content | Teaser".
Comment | File | Size | Author |
---|---|---|---|
#23 | interdiff-2188031-23.txt | 4.79 KB | damiankloip |
#23 | 2188031-23.patch | 9.47 KB | damiankloip |
Comments
Comment #3
dawehnerOOH
Comment #4
olli CreditAttribution: olli commentedThis removes all defaults from annotations and adds an isset() in fetchPluginNames().
Comment #5
olli CreditAttribution: olli commentedThose "Undefined index: title" notices are coming from calls to fetchPluginNames() from Drupal\views\Plugin\views\display\Feed::initDisplay() and the plugin ids are entity:user, entity:node and entity:comment. I don't see why/how the derivative definitions are not merged here. Any ideas?
Comment #6
dawehnerDid maybe #2184951: Allow plugins to declare themselves a derivative caused that?
Comment #7
olli CreditAttribution: olli commentedTo reproduce the notices: install minimal profile, goto admin/modules, check aggregator, menu, views and click "Save configuration". Our derivatives do not work during menu_install() because viewsdata has a fresh module handler that is not loaded yet. Adding loadAll in menu_install or modulehandler::install fixes this but is there a reason why we are not loading it?
Comment #8
dawehnerMaybe we should reset it so it will be loaded again automatically later?
Comment #9
benjy CreditAttribution: benjy commentedI had the same issue and can confirm that the attached patch fixes the problem.
Comment #10
dawehnerat least $this->loadAll() could be used instead. Have you tried to use $this->reset() to lazy do that loading?
Comment #11
olli CreditAttribution: olli commentedRe #10: It looks like it is not $this module handler but the other one from kernel->updateModules that we get in viewsdata.
Here's an alternative modifying #2184951: Allow plugins to declare themselves a derivative.
EDIT: This ignores entity:user, entity:comment and entity:node until they are found by our deriver. DerivativeDiscoveryDecorator::getDefinition would need a similar change.
Comment #12
dawehnerAwesome work!
Comment #13
tim.plunkettI don't understand, why are we removing the defaults? That wasn't really explained.
And there aren't any tests yet, so not RTBC.
Comment #14
olli CreditAttribution: olli commentedRe #13: With defaults, this will be something like array('title' => '', ...) + array('title' => 'Content', ...). Is there another way around this?
Comment #15
olli CreditAttribution: olli commentedWould you prefer something like this to keep the defaults?
Comment #16
tim.plunkettAffects row plugins too #2217571: Cannot use Content row plugin in Views UI
Comment #17
damiankloip CreditAttribution: damiankloip commentedI also created #2221037: Empty base plugin definitions overwrite derivative definitions when a plugin (annotation/id) is used as a derivative, which was just closed as a dupe of this.
One thing that issue does that this does not, is keep any other default values that the derivative doesn't populate. I think that is a better approach, as you are guaranteed more consistency between plugin definitions then? I was also talking to chx about this, the method I used in above issue means you could not override an empty value on your plugin annotation as the derivative definition would win in that case.
Or do we say if you are doing this, derivatives have to specify all their keys manually (which I think this does?).
Or do we let the defaults array on plugin managers handle that instead? Then the annotation classes are purely for documentation purposes really.
Comment #18
damiankloip CreditAttribution: damiankloip commentedThis is actually a missing row plugin but #2221503: Missing row plugin text in Views UI says 'style'. So closed issue from #16 was also correct in its naming. This is all the same thing :)
Comment #19
damiankloip CreditAttribution: damiankloip commentedHere is the patch from #2221037: Empty base plugin definitions overwrite derivative definitions when a plugin (annotation/id) is used as a derivative. I think it makes more sense to try and fix this at the derivate level, rather than the plugin level. Like mentioned before, this means it is hard to override a value with an empty one. But will that case come up really? In that case, you just don't make it a derivative or something.
thoughts? olli?
Comment #20
tim.plunkettI really really prefer this approach. +1
Comment #21
olli CreditAttribution: olli commentedI agree, just couldn't figure out how and removed empty defaults from the annotation class so they get filtered out in Plugin::__construct().
Also with non-empty default (register_theme here) I thought it should get any value set by the derivative discovery so I removed that too.
#19 looks simple and works most of the time, and if it doesn't, use _alter() like before.
Comment #22
olli CreditAttribution: olli commentedWe still need to change and test DerivativeDiscoveryDecorator::getDefinition(), right?
Comment #23
damiankloip CreditAttribution: damiankloip commentedYes! let's do that now. Added some unit test coverage too.
Comment #24
damiankloip CreditAttribution: damiankloip commentedComment #25
dawehnerCool!
Comment #26
catchCommitted/pushed to 8.x, thanks!