You are here

function _spaces_og_form_alter_group in Spaces 7

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. 6.2 spaces_og/spaces_og.module \_spaces_og_form_alter_group()
  5. 7.3 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
Implements hook_form_alter().

File

spaces_og/spaces_og.pages.inc, line 80

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']);

  // Add purl form.
  $form['purl'] = purl_form('spaces_og', isset($form['#node']->nid) ? $form['#node']->nid : NULL, isset($form_state['node_preview']) ? $form['#node']->purl['value'] : $form['#node']->purl);

  // Add preset form.
  // @TODO: Test with node preview.
  module_load_include('inc', 'spaces', 'spaces.admin');
  $nid = isset($form['#node']->nid) ? $form['#node']->nid : NULL;
  if ($space = spaces_load('og', $nid)) {
    $space
      ->activate();
  }
  $presets = spaces_preset_load(NULL, 'og');
  if (count($presets) > 1) {
    $form['spaces_preset'] = spaces_preset_form($presets, 'og');
  }

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

  // Add additional submit handler that redirects to group homepage.
  if (!empty($form['buttons']['submit']['#submit'])) {
    $form['buttons']['submit']['#submit'][] = 'spaces_og_form_group_submit';
  }
}