You are here

function _spaces_og_group_node_form_submit in Spaces 5.2

Same name and namespace in other branches
  1. 6 spaces_og/spaces_og.module \_spaces_og_group_node_form_submit()
  2. 6.2 spaces_og/spaces_og.module \_spaces_og_group_node_form_submit()

Custom submit handler for group node forms

File

./spaces_og.module, line 619

Code

function _spaces_og_group_node_form_submit($form_id, $form_values) {

  // Prefix might have changed -- do the redirect correctly
  if (isset($form_values['nid']) && isset($form_values['context_prefix']['prefix'])) {
    $nid = $form_values['nid'];
    $prefix = $form_values['context_prefix']['prefix'];
    $space = spaces_load('og', $nid);
    if ($space) {

      // Reset prefix static cache since the prefix for this group might have been changed
      $method = variable_get('context_prefix_method_' . 'spaces_og', CONTEXT_PREFIX_PATH);
      $prefixes = context_prefix_prefixes($method, TRUE);
      $space->prefix = $prefix;
      $space
        ->redirect('home');
    }
  }
}