function forum_overview

Form constructor for the forum overview form.

Returns a form for controlling the hierarchy of existing forums and containers.

See also

forum_menu()

Related topics

1 string reference to 'forum_overview'
forum_menu in modules/forum/forum.module
Implements hook_menu().

File

modules/forum/forum.admin.inc, line 270

Code

function forum_overview($form, &$form_state) {
    module_load_include('inc', 'taxonomy', 'taxonomy.admin');
    $vid = variable_get('forum_nav_vocabulary', '');
    $vocabulary = taxonomy_vocabulary_load($vid);
    $form = taxonomy_overview_terms($form, $form_state, $vocabulary);
    foreach (element_children($form) as $key) {
        if (isset($form[$key]['#term'])) {
            $term = $form[$key]['#term'];
            $form[$key]['view']['#href'] = 'forum/' . $term['tid'];
            if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
                $form[$key]['edit']['#title'] = t('edit container');
                $form[$key]['edit']['#href'] = 'admin/structure/forum/edit/container/' . $term['tid'];
            }
            else {
                $form[$key]['edit']['#title'] = t('edit forum');
                $form[$key]['edit']['#href'] = 'admin/structure/forum/edit/forum/' . $term['tid'];
            }
        }
    }
    // Remove the alphabetical reset.
    unset($form['actions']['reset_alphabetical']);
    // The form needs to have submit and validate handlers set explicitly.
    $form['#theme'] = 'taxonomy_overview_terms';
    $form['#submit'] = array(
        'taxonomy_overview_terms_submit',
    );
    // Use the existing taxonomy overview submit handler.
    $form['#empty_text'] = t('No containers or forums available. <a href="@container">Add container</a> or <a href="@forum">Add forum</a>.', array(
        '@container' => url('admin/structure/forum/add/container'),
        '@forum' => url('admin/structure/forum/add/forum'),
    ));
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.