You are here

function advanced_forum_forum_context_settings_form in Advanced Forum 7.2

Same name and namespace in other branches
  1. 6.2 plugins/contexts/forum.inc \advanced_forum_forum_context_settings_form()

Context settings form.

1 string reference to 'advanced_forum_forum_context_settings_form'
forum.inc in plugins/contexts/forum.inc
Plugin to provide a user context

File

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

Code

function advanced_forum_forum_context_settings_form($form, &$form_state) {
  $conf = $form_state['conf'];
  if (empty($conf)) {
    $conf = array(
      'tid' => 0,
    );
  }
  $options = array();
  $vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0));
  $options[$vocabulary->vid] = $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;
}