great module!
However, I managed to generate the perfect storm which causes share to fail:
1. I have a gallery node which node_views a number of 'child' nodes.
2. the child nodes, in turn, generate links, which get passed through link_alter.
3. the forward form is generated for the FIRST child node, rather than the parent gallery node.
Now, i probably shouldn't have been generating links for these child nodes anyways, since I wasn't showing them; so I set the links argument in node_view to FALSE. Oddly enough, these child nodes STILL got passed to link_alter (with an empty links argument), even though I wasn't generating links for them. Here's where it gets interesting!
1. Turns out, if taxonomy is installed and turned on, the phptemplate engine will call the taxonomy_links function on a theme_node call, from phptemplate_node. theme_node is run on EVERY node_view, whether or not you are generating links for that node.
2. taxonomy links invokes the link_alter hook manually! This causes nodes that aren't 'supposed' to be going through the link process to go through the link process.
3. since share doesn't really "alter" links, so much as "adds" them, it happily generates the share forms from these 'non-links' nodes. I haven't traced why exactly this ends up being the FIRST node that gets passed through instead of the last (which would've given me the correct result), but this is what happens.
Anyways, easy fix in my case -- i just test to see if $links is empty. If it is, I skip the form generation. I'm not sure so much this is a bug with share as a total weird case where link_alter gets run for everything regardless of whether node_view has told it not to generate links. Still, in cases where link_alter isn't basing it's output on the contents of $links, we can get weird results.
thought you might like to know! I know i learned something.
Comments
Comment #1
greenskin commentedThis is a weird issue. I agree that not sure if it should be addressed in the Share module or elsewhere. Since you found a workaround solution, I'm setting this to "won't fix". If others come across this same issue they can try your method of fixing it or make a suggestion on what Share module can do to help with this.