Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Starting with #2005716: Promote EntityType to a domain object we no longer require plugin definitions to be arrays. However, \Drupal\Component\Plugin\PluginManagerBase::processDefinition()
expects them to be arrays in order to merge in defaults.
Personally, I'd empty the body of this method, remove the defaults
property, and move the method to DefaultPluginManager
(which is the only place that calls the method), but that proposal was met with some resistance on IRC.
Instead, we can simply check if the definition is an array and don't do anything if it isn't.
Comment | File | Size | Author |
---|---|---|---|
#5 | drupal_2170435_5.patch | 2.63 KB | Xano |
#5 | interdiff.txt | 415 bytes | Xano |
Comments
Comment #1
XanoComment #2
EclipseGc CreditAttribution: EclipseGc commentedOk, per our IRC conversation, let's try something more like this. I double checked all the grep-able instances of this use and didn't see any reason this wouldn't work. It's also not a part of the interface, so I think this is kosher.
Eclipse
Comment #3
neclimdulsince NestedArray isn't used anymore in the component manager we should remove the NestedArray use.
Comment #4
EclipseGc CreditAttribution: EclipseGc commentedAnd make sure it's added in DefaultPluginManager... yeah my bad.
Eclipse
Comment #5
XanoComment #6
neclimdulThis seems like the right thing to do.
Comment #7
tim.plunkettLooks good to me. See #2170775: Remove array typehint from $plugin_definition for the (hopefully) last of these issues.
Comment #8
catchCommitted/pushed to 8.x, thanks!
Comment #9
tstoecklerCan someone explain why the is_array($definition) was dropped? I would have expected that to part of the if as well.
Comment #10
XanoI don't know, but I also don't know if that's too bad, as it may cause silent failures. With the current solution, if you want defaults and you configure those as an array in the
defaults
property, and if your definition is not an array, you have done something wrong and you'll need to get an error anyway.Comment #11
tstoecklerHmm... yeah that makes sense. Thanks!