You are here

function tagadelic_plugin_style::build_cloud in Views Tagadelic 7.2

1 call to tagadelic_plugin_style::build_cloud()
tagadelic_plugin_style::pre_render in includes/tagadelic_plugin_style.inc
Allow the style to do stuff before each row is rendered.

File

includes/tagadelic_plugin_style.inc, line 139
Contains the tagadelic style plugin.

Class

tagadelic_plugin_style
Style plugin to render a weighted set of taxonomy terms.

Code

function build_cloud($result) {
  drupal_add_css(drupal_get_path('module', 'tagadelic') . '/tagadelic.css');
  $count_field = $this->options['count_field'];
  $columns = $this->display->handler
    ->get_option('fields');
  $count_field_alias = NULL;
  if (isset($this->view->field[$count_field])) {
    $count_field_alias = $this->view->field[$count_field]->field_alias;
  }
  if (!$count_field_alias) {
    drupal_set_message("Please set which field you are using for counting results in the tagadelic display.", "error");
    return "";
  }
  $tags = array();
  foreach ($result as $index => $item) {
    $count = floatval($item->{$count_field_alias});
    $tag = new TagadelicTag($index, "", $count);
    $tags[] = $tag;
  }
  $cloud = new TagadelicCloud($this->view->name, $tags);
  $this->cloud_tags = $cloud
    ->get_tags();
}