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.
Child plugins don't get passed to _ctools_process_data(). This means that they don't get defaults set (such as the module name), don't get passed to the alter hooks, and don't get passed to the plugin owner for processing.
In ctools_get_plugins():
// Then see if we should load all files. We only do this if we
// want a list of all plugins or there was a cache miss.
if (empty($setup[$module][$type]) && ($build_cache || !$id)) {
$setup[$module][$type] = TRUE;
###### This loads each plugin .inc file. For each file, ctools_plugin_process() is called, which then calls _ctools_process_data() which does the plugin processing work.
$plugins[$module][$type] = array_merge($plugins[$module][$type], ctools_plugin_load_includes($info[$module][$type]));
// If the plugin can have child plugins, and we're loading all plugins,
// go through the list of plugins we have and find child plugins.
if (!$id && !empty($info[$module][$type]['child plugins'])) {
// If a plugin supports children, go through each plugin and ask.
$temp = array();
foreach ($plugins[$module][$type] as $name => $plugin) {
// The strpos ensures that we don't try to find children for plugins
// that are already children.
if (!empty($plugin['get children']) && function_exists($plugin['get children']) && strpos($name, ':') === FALSE) {
#### The child plugins are merged into the array here -- they don't get processed.
$temp = array_merge($plugin['get children']($plugin, $name), $temp);
}
else {
$temp[$name] = $plugin;
}
}
$plugins[$module][$type] = $temp;
}
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 2530318-2.ctools.child-plugins-processing.patch | 1.78 KB | joachim |
Comments
Comment #1
joachim CreditAttribution: joachim commentedHere's a patch.
Comment #2
joachim CreditAttribution: joachim commentedI missed the 'get child' case -- updated patch.
Comment #3
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 9 July 2015 patch to plugins.inc applied cleanly to the latest ctools 7.x-1.x-dev and if still applicable needs to be reviewed.
Comment #4
joelpittetThis looks like a big oversight but not a lot of attention, I'll attach it to a release plan, probably won't make it into the next release but a future one and see if any others can test it out.
Comment #5
joelpittetComment #6
joelpittet