You are here

function site_map_block in Site map 6

Same name and namespace in other branches
  1. 5 site_map.module \site_map_block()
  2. 6.2 site_map.module \site_map_block()

Implements hook_block().

File

./site_map.module, line 71
Original author: Nic Ivy Now maintained by by Fredrik Jonsson fredrik at combonet dot se

Code

function site_map_block($op = 'list', $delta = 0) {
  if ($op == 'list') {
    $blocks[0]['info'] = t('Syndicate (site map)');
    return $blocks;
  }
  elseif ($op == 'view') {
    if (user_access('access content')) {
      $block['subject'] = t('Syndicate');
      if (arg(0) == 'blog') {
        $uid = arg(1);
        $feedurl = is_numeric($uid) ? "blog/{$uid}/feed" : 'blog/feed';
      }
      else {
        $feedurl = variable_get('site_map_rss_front', 'rss.xml');
      }
      $block['content'] = theme('feed_icon', url($feedurl), t('Syndicate'));
      $block['content'] .= '<div class="more-link">' . l(t('more'), 'sitemap', array(
        'title' => t('View the site map to see more RSS feeds.'),
      )) . "</div>\n";
      return $block;
    }
  }
}