function theme_wikitools_create in Wikitools 6
Same name and namespace in other branches
- 7 wikitools.pages.inc \theme_wikitools_create()
 
1 theme call to theme_wikitools_create()
File
- ./
wikitools.pages.inc, line 188  - Page callbacks for wikitools pages.
 
Code
function theme_wikitools_create($page_name) {
  $node_types = wikitools_node_types();
  $form = array();
  $output = '';
  if (wikitools_node_creation() && count($node_types)) {
    $output .= '<p>' . t('You can create the page as:') . '</p>';
    // Collapse the forms initially if there are more than one.
    $collapsed = count($node_types) > 1 ? ' collapsed' : '';
    // The form_alter hooks excpects the preset title in the GET array, so we put it there.
    $_GET['edit']['title'] = $page_name;
    foreach ($node_types as $type) {
      drupal_add_js('misc/collapse.js');
      $type = node_get_types('type', $type);
      if (node_access('create', $type->type)) {
        $output .= '<fieldset class="collapsible' . $collapsed . '"><legend>' . $type->name . '</legend>';
        if ($router_item = menu_get_item('node/add/' . str_replace('_', '-', $type->type))) {
          if ($router_item['file']) {
            require_once $router_item['file'];
          }
          $output .= call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
        }
        $output .= '</fieldset>';
      }
    }
    // Some of the callbacks could have set the page title, so we reset it.
    drupal_set_title(t('Page does not exist: %page', array(
      '%page' => $page_name,
    )));
  }
  return $output;
}