This stems from #564492: Plugin definition incompatibilities.
If I define the plugin in a .info file, the class file is loaded at the proper time, but a new bug pops up. This code:
// If cached the .inc file may not have been loaded. require_once is quite safe
// and fast so it's okay to keep calling it.
if (isset($plugin['file'])) {
require_once './' . $plugin['path'] . '/' . $plugin['file'];
}
from ctools_plugin_get_class() tries to include $plugin['file'], which in this case is a .info file. This results in the contents of the info file being output to the browser.
The same code block exists in ctools_plugin_get_function().
This patch seems to fix the issue. It seems like I should be able to check to see if the ['info file'] flag is set on the plugin info, but I couldn't figure out how to get that.
Comments
Comment #1
merlinofchaos commentedUse ctools_plugin_get_info() to get the $info -- the arguments needed should be available from the $plugin data. That's much safer than checking for .info
Comment #2
zroger commentednew patch using ctools_plugin_get_info() and checking $info['info file'] rather than the strpos().
Comment #3
zroger commentednew patch using empty() to avoid notices.
Comment #4
merlinofchaos commentedCommitted!