You are here

function workspace_add_form in Workspace 6

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

Form definition for content addition form.

1 string reference to 'workspace_add_form'
workspace_list_content in ./workspace.module
Menu callback. Display list of content.

File

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

Code

function workspace_add_form() {
  global $user;
  $description = t('Choose what kind of content you would like to add.') . ' ' . l(t('Help?'), 'node/add');
  $select = t('Select...');
  $options = array(
    $select => $select,
  );
  foreach (node_get_types() as $type => $object) {
    if (module_invoke(node_get_types('module', $type), 'access', 'create', $type, $user)) {
      $options[$type] = $object->name;
    }
  }
  if (count($options) == 1) {
    return array();
  }
  $form['add'] = array(
    '#type' => 'fieldset',
    '#prefix' => '<div class="container-inline">',
    '#suffix' => '</div>',
  );
  $form['add']['content_type'] = array(
    '#type' => 'select',
    '#options' => $options,
  );
  $form['add']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add new item'),
    '#suffix' => $description,
  );
  return $form;
}