You are here

function workspace_add_form_submit in Workspace 6

Same name and namespace in other branches
  1. 7 workspace.module \workspace_add_form_submit()

Submit handler for content addition form.

Simply redirects to appropriate node/add/* page.

See also

workspace_add_form()

File

./workspace.module, line 508
Presents a user-centric view of content.

Code

function workspace_add_form_submit($form, $form_state) {
  $node_type = $form_state['values']['content_type'];
  if ($node_type == t('Select...')) {
    drupal_goto('node/add');
  }
  foreach (node_get_types() as $type => $object) {
    if (node_access('create', $type, $user->uid)) {
      $options[$type] = $object->name;
    }
    if (isset($options[$node_type])) {

      /* Start hack */
      if (stristr($node_type, "_") > -1) {
        $node_type = str_replace("_", "-", $node_type);
      }

      /* End hack */
      drupal_goto('node/add/' . $node_type);
    }
  }
}