You are here

function _spaces_og_form_alter_group in Spaces 6.2

Same name and namespace in other branches
  1. 5.2 spaces_og.module \_spaces_og_form_alter_group()
  2. 6.3 spaces_og/spaces_og.pages.inc \_spaces_og_form_alter_group()
  3. 6 spaces_og/spaces_og.module \_spaces_og_form_alter_group()
  4. 7.3 spaces_og/spaces_og.pages.inc \_spaces_og_form_alter_group()
  5. 7 spaces_og/spaces_og.pages.inc \_spaces_og_form_alter_group()

Group node form_alter(). @TODO: repair default values on node previews.

1 call to _spaces_og_form_alter_group()
spaces_og_form_alter in spaces_og/spaces_og.module

File

spaces_og/spaces_og.module, line 777

Code

function _spaces_og_form_alter_group(&$form, $form_state) {
  _spaces_og_make_hidden($form['og_selective']);
  _spaces_og_make_hidden($form['og_register']);
  _spaces_og_make_hidden($form['og_private']);
  _spaces_og_make_hidden($form['og_directory']);
  _spaces_og_make_hidden($form['themes']);

  // Add purl form
  // This case handles node previews
  if (isset($form_state['node_preview'])) {
    $form['purl'] = purl_form('spaces_og', $form['#node']->nid, $form['#node']->purl['value']);
  }
  else {
    $form['purl'] = purl_form('spaces_og', $form['#node']->nid, $form['#node']->purl);
  }

  // Add presets form
  $nid = isset($form['#node']->nid) ? $form['#node']->nid : NULL;
  $space = spaces_load('og', $nid);

  // Preserve value on preview
  if (isset($form_state['node_preview'])) {
    $space->preset = $form_state['values']['preset'];
  }
  $form['spaces_preset'] = spaces_form_presets($space);

  // Pass existing space through
  if ($nid) {
    $form['space'] = array(
      '#type' => 'value',
      '#value' => $space,
    );
  }

  // Add custom submit handler
  $form['#submit'][] = '_spaces_og_group_node_form_submit';
}