You are here

public function advanced_forum_plugin_style_forum_topic_list::get_forum_ids in Advanced Forum 7.2

Same name and namespace in other branches
  1. 6.2 includes/views/advanced_forum_plugin_style_forum_topic_list.inc \advanced_forum_plugin_style_forum_topic_list::get_forum_ids()

Figure out what the forum ID is. It could have come from an argument or a filter or nowhere.

This source would be set by the user in the options.

File

includes/views/advanced_forum_plugin_style_forum_topic_list.inc, line 64
Contains the topic list style plugin.

Class

advanced_forum_plugin_style_forum_topic_list

Code

public function get_forum_ids() {
  $where = $this->options['tid'];
  if (empty($where)) {
    return;
  }
  $term = '';
  list($type, $id) = explode('.', $where, 2);
  $handler = $this->display->handler
    ->get_handler($type, $id);
  if ($type == 'argument') {
    return empty($handler->argument) ? array() : array(
      $handler->argument,
    );
  }
  else {
    $terms = is_array($handler->value) ? $handler->value : array(
      $handler->value,
    );
    if (isset($handler->options['depth'])) {
      foreach ($terms as $tid) {
        $term = taxonomy_term_load($tid);
        $tree = taxonomy_get_tree($term->vid, $tid, -1, $handler->options['depth']);
        $terms = array_merge($terms, array_map('_taxonomy_get_tid_from_term', $tree));
      }
    }
    return $terms;
  }
}