"Service Links" module block not visible on Panels and Views

rubaff - April 24, 2009 - 13:52

Hi Drupal-Fans,

unfortunately the module service links shows the links only on full nodes, not on view-pages or panel-pages.
Has anyone ever experienced this problem or even solved it?

Many thanks, rubaff!

Found a quick fix

marcus45 - October 18, 2009 - 23:37

Whats up,
Hopefully you have already found a solution to your problem. I was having the same problem and here is what worked for me:

Basically the idea here is to make use of the service links block. First go to the block admin page (Site Building ->Blocks).

If you don't have the admin menu then I would highly recommend installing the Administration Menu module. It will make navigating the admin pages much simpler.

Next find the Service Links Block in the list of Disabled blocks. Then use the drop-down menu for Service Links to move the block to a region of your choosing. Save the configuration by clicking the Save blocks button on the bottom of the page. Then click on the configure link on the service link block and check the visibility settings to confirm that the settings are what you want them to be or change them accordingly.

Now you will have modify the module itself. Find the folder that contains the service links module. In the file service_links.module locate the function service_links_block. Replace the existing function definition with the one below. Be sure to keep a copy of the original or just comment out the original:

/**
* Implementation of hook_block().
*/
function service_links_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks[0]['info'] = t('Service links');
return $blocks;
}
else if ($op == 'view') {
/*if (user_access('access service links') && arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
$links_show = _service_links_show($node);
if ($links_show) {
$block['subject'] = t('Share');
$block['content'] = theme('service_links_block_format', service_links_render($node));
}
}
*/
$block['subject'] = t('Share');
$block['content'] = theme('service_links_block_format', service_links_render($node));
return $block;
}
}

Basically all I did was comment out the if statement under else if($op == 'view'); now the block will show always when it is in a region. You can play around with the if statement and see what works for you. For most cases this should work.

Yes I know that it isn't always a good idea to modify the module in such a way but I couldn't find the proper settings configuration to make it work otherwise. If anyone has a better way then I would be open to hearing about it.

Hope this helps.

Thanks for the reply! I used

rubaff - October 19, 2009 - 11:20

Thanks for the reply!

I used a workaround (used static links in a block on views), but next time I will def try your solution.

 
 

Drupal is a registered trademark of Dries Buytaert.