I'm using the Metatag Context submodule of Metatag and have found that CTools doesn't believe that the class metatag_context_reaction exists. I can see that metatag_context_context_plugins() has implemented hook_context_plugins() as per API.txt, however the include file for the handler is never loaded. I'm not sure if this is a bug in ctools, a bug in context or just a documentation issue.
I can resolve the issue by declaring the "file" property outside of the "handler" array. For example:
/**
* Implements hook_context_plugins().
*/
function metatag_context_context_plugins() {
return array(
'metatag_context_reaction' => array(
'handler' => array(
'path' => drupal_get_path('module', 'metatag_context'),
'file' => 'metatag_context.context.inc',
'class' => 'metatag_context_reaction',
'parent' => 'context_reaction',
),
'file' => 'metatag_context.context.inc',
),
);
}
Is this a bug, or a documentation issue?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 1871798-6-clear-cache-on-module-enable.patch | 537 bytes | mstrelan |
| #4 | 1871798-clear-cache-on-module-enable.patch | 521 bytes | mstrelan |
Comments
Comment #1
damienmckennaI was able to get it to work using the following in Metatag:
Clarification: this was written against 7.x-3.0-beta4, I've honestly not tried it with beta5 or beta6 yet.
Comment #2
mstrelan commentedNevermind, it turns out you need to flush the cache after installing metatag_context if context was already previously installed.
Comment #3
damienmckenna@mstrelan: I'm moving this over to the Metatag module to add a cache_clear_all() call during metatag_context_install() that would clear out the context cache, so other developers don't have this problem.
Comment #4
mstrelan commentedPatch attached
Comment #5
damienmckennaA small request - this should just clear the Context plugins rather than clear everything.
Comment #6
mstrelan commentedGood call. I spent some time testing for the right cache to flush earlier but didn't see this one. This should do the trick.
Comment #7
damienmckennaIt needs some extra comments, given it's a new file, but this is great.
Once #1798294: Can't edit non-current node revisions is resolved I'll commit this.
Comment #8
damienmckennaCommitted.
Comment #9
damienmckennaComment #10
damienmckennaNow that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.