You are here

function community_tags_block in Community Tags 6.2

Same name and namespace in other branches
  1. 5 community_tags.module \community_tags_block()
  2. 6 community_tags.module \community_tags_block()

Implementation of hook_block().

File

./community_tags.module, line 171
Implements community tagging of nodes using a specific vocabulary for Drupal v6.x

Code

function community_tags_block($op = 'list', $delta = 0, $edit = array()) {
  global $user;
  switch ($op) {
    case 'list':

      // tagging form block should not be cached as block uses JS settings in community_tags_node_view()
      $block[0] = array(
        'info' => t('Community tagging form'),
        'cache' => BLOCK_NO_CACHE,
      );
      return $block;
    case 'view':
      if (_community_tags_view_access()) {
        if (arg(0) == 'node' && is_numeric(arg(1)) && (arg(2) == '' || arg(2) == 'view')) {
          $node = menu_get_object();
          if (_community_tags_is_tagging_view_visible($node, COMMUNITY_TAGS_MODE_BLOCK)) {
            $block['subject'] = t('Tag this');
            $block['content'] = community_tags_node_view($node, TRUE);
            return $block;
          }
        }
      }
      break;
  }
}