You are here

function tagadelic_page_list in Tagadelic 5

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

menu callback renders a tagadelic page with listed items: each voc

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

File

./tagadelic.module, line 128

Code

function tagadelic_page_list() {
  $vocs = arg(2);
  if (is_numeric($vocs)) {
    $vocs = array(
      $vocs,
    );
  }
  elseif (preg_match('/^([0-9]+,){1,5}[0-9]+$/', $vocs)) {
    $vocs = explode(',', $vocs);
  }
  else {
    return drupal_not_found();
  }
  foreach ($vocs as $vid) {
    $vocabulary = taxonomy_get_vocabulary($vid);
    $tags = tagadelic_get_weighted_tags(array(
      $vocabulary->vid,
    ), variable_get('tagadelic_levels', 6), variable_get('tagadelic_page_amount', '60'));
    $tags = tagadelic_sort_tags($tags);
    $output .= theme('tagadelic_list_box', $vocabulary, $tags);
  }
  if (!$output) {
    return drupal_not_found();
  }
  $stylesheet = drupal_get_path('module', 'tagadelic') . '/tagadelic.css';
  drupal_add_css($stylesheet, 'all');
  $output = "<div class=\"wrapper tagadelic\">{$output}</div>";
  return $output;
}