From #321295: Errors when other modules incorrectly implement link_alter I did a search for modules that incorrectly implement link_alter. panels 6.x-2.x is one of the offenders. The docs for hook_link_alter say that the function should be passed $links, then $node (a reversal from D5). You can see an example of the correct implementation of node_view. Your implementation currently passes the parameters in reverse.
Current 6.x-2.x code in panels/content_types/node_content.inc:
function panels_admin_node_content($node, $conf) {
...
if ($conf['links']) {
$node->links = module_invoke_all('link', 'node', $node, $conf['teaser']);
foreach (module_implements('link_alter') AS $module) {
$function = $module .'_link_alter';
$function($node, $node->links);
}
}
Correct version:
function panels_admin_node_content($node, $conf) {
...
if ($conf['links']) {
$node->links = module_invoke_all('link', 'node', $node, $conf['teaser']);
drupal_alter('link', $node->links, $node);
}
Attached patch against current 6.x-2.x that fixes the parameter order and uses drupal_alter, which is the preferred implementation in core (see the link to node_view above). Please also note that there is the same code in the 6.x-3.x version, but it looks like that code is not active.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | panels-link-alter-D6.patch | 873 bytes | dave reid |
Comments
Comment #1
dave reidComment #2
lameei commented+1
Comment #3
dave reidAny of the mainainers taken a look at this yet? This is a mis-use of the Drupal APIs and is causing problems for other modules that implement it correctly. lameei or anyone else, you can mark this as "Reviewed and Tested by the Community" if this patch applies cleanly and works for you.
Comment #4
merlinofchaos commentedI committed this to the 3.x branch. This still needs to be committed to the 2.x branch.
Comment #5
merlinofchaos commentedPanels 2 is no longer available and is unsupported. Marking all Panels 2 issues won't fix.
Comment #6
dave reidSounds good Earl. Thanks for Panels 3. :)