You are here

function og_node_delete_group_form in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og.module \og_node_delete_group_form()
  2. 5 og.module \og_node_delete_group_form()
  3. 5.2 og.module \og_node_delete_group_form()
  4. 5.3 og.module \og_node_delete_group_form()
  5. 5.7 og.module \og_node_delete_group_form()
  6. 6.2 og.module \og_node_delete_group_form()
1 call to og_node_delete_group_form()
og_form_node_delete_confirm_alter in ./og.module

File

./og.module, line 1859

Code

function og_node_delete_group_form(&$form) {
  $options[OG_DELETE_NOTHING] = t('Do nothing.');
  $options[OG_DELETE_ORPHANS] = t("Delete all group posts which don't also belong to another group.");
  if (user_access('administer nodes')) {
    $options[OG_DELETE_MOVE_NODES] = t('Move all group posts to the group listed below.');
    $options[OG_DELETE_MOVE_NODES_MEMBERSHIPS] = t('Move all group posts and memberships to the group listed below.');
  }
  $form['verb'] = array(
    '#type' => 'radios',
    '#title' => t('Group posts'),
    '#options' => $options,
    '#default_value' => OG_DELETE_NOTHING,
    '#weight' => -1,
    '#description' => t('In addition to deleting this group, you choose how to disposition the posts and memberships within it.'),
  );
  if (user_access('administer nodes')) {
    $options = og_all_groups_options();
    unset($options[$form['nid']['#value']]);
    $form['target'] = array(
      '#type' => 'select',
      '#title' => t('Target group'),
      '#default_value' => 0,
      '#options' => $options,
      '#weight' => 0,
      '#description' => t('If you chose <strong>Move all group posts</strong> above, specify a destination group.'),
    );

    // Register a submit handlers for moving child nodes and memberships.
    // Memberships should move before the group node is deleted.
    // Group nodes wait until afterwards so that our custom redirect works.
    array_unshift($form['#submit'], 'og_node_delete_move_memberships');
    $form['#submit'][] = 'og_node_delete_confirm_submit';
  }
  $form['actions']['submit']['#value'] = t('Delete group');
}