| Versionen | |
|---|---|
| drupal6 – drupal7 | forum_overview(&$form_state) |
Returns an overview list of existing forums and containers
modules/
<?php
function forum_overview(&$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_state, $vocabulary);
foreach (element_children($form) as $key) {
if (isset($form[$key]['#term'])) {
$term = $form[$key]['#term'];
$form[$key]['view']['#value'] = l($term['name'], 'forum/' . $term['tid']);
if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
$form[$key]['edit']['#value'] = l(t('edit container'), 'admin/content/forum/edit/container/' . $term['tid']);
}
else {
$form[$key]['edit']['#value'] = l(t('edit forum'), 'admin/content/forum/edit/forum/' . $term['tid']);
}
}
}
// Remove the alphabetical reset.
unset($form['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['#validate'] = array('taxonomy_overview_terms_validate');
$form['#empty_text'] = '<em>' . t('There are no existing containers or forums. Containers and forums may be added using the <a href="@container">add container</a> and <a href="@forum">add forum</a> pages.', array('@container' => url('admin/content/forum/add/container'), '@forum' => url('admin/content/forum/add/forum'))) . '</em>';
return $form;
}
?>
Kommentare
Kommentar hinzufügen