You are here

function service_links_block_view in Service links 7.2

Implements hook_block_view().

File

./service_links.module, line 195
Adds social network links to the content.

Code

function service_links_block_view($delta = '') {
  $node = menu_get_object('node');
  $block = array();
  if (user_access('access service links') && isset($node)) {
    if (service_links_show($node)) {
      switch ($delta) {
        case 'service_links':
          $block['subject'] = t('Bookmark/Search this post');
          $style = variable_get('service_links_block_style', SERVICE_LINKS_STYLE_IMAGE_AND_TEXT);
          $block['content'] = theme('service_links_block_format', array(
            'items' => service_links_render($node, FALSE, $style),
            'style' => $style,
          ));
          break;
        case 'service_links_fisheye':
          $block['subject'] = t('Bookmark/Search this post');
          $block['content'] = theme('service_links_fisheye_format', array(
            'items' => service_links_render($node, FALSE, SERVICE_LINKS_STYLE_FISHEYE),
          ));
          break;
      }
    }
    return $block;
  }
  elseif (user_access('access service links') && !isset($node)) {
    switch ($delta) {
      case 'service_links_not_node':
        $block['subject'] = t('Bookmark/Search this post');
        $options = array(
          'style' => variable_get('service_links_block_not_node_style', SERVICE_LINKS_STYLE_IMAGE_AND_TEXT),
          'link_to_front' => variable_get('service_links_block_not_node_front', FALSE),
        );
        $block['content'] = theme('service_links_block_format', array(
          'items' => service_links_render(NULL, FALSE, $options),
          'style' => $options['style'],
        ));
        break;
    }
    return $block;
  }
}