You are here

function og_panels_form_submit in Organic groups 5

Same name and namespace in other branches
  1. 5.8 og_panels.module \og_panels_form_submit()
  2. 5.3 og_panels.module \og_panels_form_submit()
  3. 5.7 og_panels.module \og_panels_form_submit()
  4. 6 modules/og_panels/og_panels.module \og_panels_form_submit()

INSERT or UPDATE a new og_panel. If insert, redirect to layout form.

Return value

void

File

./og_panels.module, line 438

Code

function og_panels_form_submit($form_id, $form_values) {
  if ($form_values['did']) {
    $sql = "UPDATE {og_panels} SET page_title='%s', path='%s', published=%d, show_blocks=%d WHERE did = %d";
    db_query($sql, $form_values['page_title'], $form_values['path'], $form_values['published'], $form_values['show_blocks'], $form_values['did']);
    drupal_set_message(t('Group page updated.'));
  }
  else {

    // Create a new display and record that.
    $display = panels_new_display();
    panels_save_display($display);
    $sql = "INSERT INTO {og_panels} (did, nid, page_title, path, published, show_blocks) VALUES (%d, %d, '%s', '%s', %d, %d)";
    db_query($sql, $display->did, $form_values['nid'], $form_values['page_title'], $form_values['path'], $form_values['published'], $form_values['show_blocks']);
    drupal_set_message(t('Group page created.'));
    return 'node/' . $form_values['nid'] . "/og_panels/{$display->did}/panel_layout";
  }
}