You are here

function advanced_forum_forum_context_settings_form in Advanced Forum 6.2

Same name and namespace in other branches
  1. 7.2 plugins/contexts/forum.inc \advanced_forum_forum_context_settings_form()
1 string reference to 'advanced_forum_forum_context_settings_form'
advanced_forum_forum_ctools_contexts in plugins/contexts/forum.inc
Implementation of specially named hook_advanced_forum_forum_contexts().

File

plugins/contexts/forum.inc, line 67
Plugin to provide a user context

Code

function advanced_forum_forum_context_settings_form($conf) {
  if (empty($conf)) {
    $conf = array(
      'tid' => 0,
    );
  }
  $form = array();
  $options = array();
  $vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', ''));
  $options[0] = $vocabulary->name;
  $tree = taxonomy_get_tree($vocabulary->vid);
  if ($tree) {
    foreach ($tree as $term) {
      $choice = new stdClass();
      $choice->option = array(
        $term->tid => str_repeat('-', $term->depth + 1) . $term->name,
      );
      $options[] = $choice;
    }
  }
  $form['tid'] = array(
    '#type' => 'select',
    '#title' => t('Forum'),
    '#default_value' => $conf['tid'],
    '#options' => $options,
  );
  return $form;
}