You are here

function spaces_basic_form in Spaces 6

Same name and namespace in other branches
  1. 5.2 spaces_admin.inc \spaces_basic_form()
  2. 6.2 spaces_admin.inc \spaces_basic_form()
1 string reference to 'spaces_basic_form'
spaces_active_space_menu in ./spaces.module
A mild abstraction of hook_menu() items that can be used by implementing modules to embed/graft relevant spaces items into the menu tree. Should only be used when the $may_cache argument of hook_menu() is false.

File

./spaces_admin.inc, line 487

Code

function spaces_basic_form(&$form_state, $space = NULL) {

  // Attempt to get current space if not provided
  $space = !isset($space) ? spaces_get_space() : $space;
  $form = array();
  $form['space'] = array(
    '#type' => 'value',
    '#value' => $space,
  );

  // Add context prefix form
  $types = spaces_types();
  if (isset($types[$space->type]['custom prefixes']) && $types[$space->type]['custom prefixes'] != FALSE) {
    $form['purl'] = purl_form('spaces_' . $space->type, $space->sid, $space->purl);
  }

  // Add preset form
  if (count(spaces_presets($space->type))) {
    $form['preset'] = spaces_form_presets($space);
  }

  // Only add submit if one of the options are set.
  // Otherwise, add message.
  if (isset($form['purl']) || isset($form['preset'])) {
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
      '#submit' => array(
        'spaces_basic_form_submit',
      ),
    );
  }
  else {
    $space
      ->redirect('features');
  }
  $form['#theme'] = 'spaces_form';
  return $form;
}