function tagadelic_plugin_style::render in Views Tagadelic 7
Render the display in this style.
Overrides views_plugin_style::render
File
- includes/
tagadelic_plugin_style.inc, line 40 - Contains the tagadelic style plugin.
Class
- tagadelic_plugin_style
- Style plugin to render a weighted set of taxonomy terms.
Code
function render() {
/*
* function tagadelic_build_weighted_tags($tags, $steps = 6) {
*
* $tag: $tag->count, $tag->tid, $tag->name $tag->vid.
*/
$steps = 6;
if (isset($this->view->style_plugin->options['steps'])) {
$steps = $this->view->style_plugin->options['steps'];
}
$size = count($this->view->result);
// count, td.tid, td.vid, td.name, td.description
// Create a term-like object for `tagadelic_build_weighted_tags()`
$tags = array();
foreach ($this->view->result as $term) {
// dsm($term);
$tid = isset($term->taxonomy_term_data_tag_tid) ? $term->taxonomy_term_data_tag_tid : $term->tid;
$vid = isset($term->taxonomy_term_data_vid) ? $term->taxonomy_term_data_vid : $term->taxonomy_term_data_tag_vid;
$tags[$tid] = new StdClass();
$tags[$tid]->name = $term->taxonomy_term_data_tag_name;
$tags[$tid]->tid = $tid;
$tags[$tid]->vid = $vid;
$tags[$tid]->count = $term->taxonomy_term_data_tag_count;
$tags[$tid]->description = $term->taxonomy_term_data_tag_description;
}
$tags = tagadelic_build_weighted_tags($tags);
/// @todo: use views sorting options
// $tags = tagadelic_sort_tags($tags);
/// @TODO: check tagadelic requirement for vocabulary reference or rewrite theme function
$voc = new StdClass();
$voc->vid = 0;
$output = theme('tagadelic_weighted', array(
'terms' => $tags,
'voc' => $voc,
'more_link' => FALSE,
));
return $output;
}