You are here

function spaces_basic_form in Spaces 6.2

Same name and namespace in other branches
  1. 5.2 spaces_admin.inc \spaces_basic_form()
  2. 6 spaces_admin.inc \spaces_basic_form()

BASIC FORM =========================================================

File

./spaces_admin.inc, line 427

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['buttons'] = array(
      '#tree' => FALSE,
      '#theme' => 'features_form_buttons',
    );
    $form['buttons']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
      '#submit' => array(
        'spaces_basic_form_submit',
      ),
    );
  }
  else {
    $space
      ->redirect('features');
  }
  return $form;
}