You are here

function tagadelic_page_chunk in Tagadelic 5

Same name and namespace in other branches
  1. 6 tagadelic.module \tagadelic_page_chunk()
  2. 7 tagadelic.module \tagadelic_page_chunk()

menu callback renders a tagadelic page

1 string reference to 'tagadelic_page_chunk'
tagadelic_menu in ./tagadelic.module
Implementation of hook_menu

File

./tagadelic.module, line 97

Code

function tagadelic_page_chunk() {
  $vocs = arg(2);
  if (is_numeric($vocs)) {
    $vocs = array(
      $vocs,
    );
  }
  elseif (preg_match('/^([0-9]+,){1,5}[0-9]+$/', $vocs)) {
    $vocs = explode(',', $vocs);
  }
  elseif ($vocs == NULL) {

    //create a chunk from all free tagging vocs
    foreach (taxonomy_get_vocabularies(NULL) as $vocabulary) {
      $vocs[] = $vocabulary->vid;
    }
  }
  $tags = tagadelic_get_weighted_tags($vocs, variable_get('tagadelic_levels', 6), variable_get('tagadelic_page_amount', '60'));
  $tags = tagadelic_sort_tags($tags);
  $output = theme('tagadelic_weighted', $tags);
  if (!$output) {
    return drupal_not_found();
  }
  $output = "<div class=\"wrapper tagadelic\">{$output}</div>";
  return $output;
}