You are here

function og_subgroups_settings in Subgroups for Organic groups 5.3

Same name and namespace in other branches
  1. 5.4 og_subgroups.module \og_subgroups_settings()
  2. 5 og_subgroups.module \og_subgroups_settings()
  3. 6 includes/admin.inc \og_subgroups_settings()
1 string reference to 'og_subgroups_settings'
og_subgroups_menu in ./og_subgroups.module
@file Maintains a hierarchy of group/subgroup relationships.

File

./og_subgroups.module, line 116
Maintains a hierarchy of group/subgroup relationships.

Code

function og_subgroups_settings() {
  $form['og_subgroups_settings']['og_subgroups_parent_children_types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Parent-Child Group Relationships'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['og_subgroups_settings']['og_subgroups_prop_type'] = array(
    '#type' => 'radios',
    '#title' => t('Post Propagation Direction'),
    '#default_value' => variable_get('og_subgroups_prop_type', 'none'),
    '#options' => array(
      'parents' => t('Up the tree'),
      'children' => t('Down the tree'),
      'none' => t('No propagation'),
    ),
    '#multiple' => FALSE,
    '#description' => t("When a post is created inside an OG, should it propagate to that group's parents, children, or not at all?"),
  );
  $og_types = variable_get('og_node_types', array());
  foreach ($og_types as $child_type) {
    $form['og_subgroups_settings']['og_subgroups_parent_children_types']['og_subgroups_child_' . $child_type] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#title' => ucfirst($child_type),
    );
    $form['og_subgroups_settings']['og_subgroups_parent_children_types']['og_subgroups_child_' . $child_type]['og_subgroups_form_settings_' . $child_type] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
      '#title' => t('Form Settings'),
    );
    $form['og_subgroups_settings']['og_subgroups_parent_children_types']['og_subgroups_child_' . $child_type]['og_subgroups_form_settings_' . $child_type]['og_subgroups_' . $child_type . '_set_parents'] = array(
      '#type' => 'checkbox',
      '#title' => t("Provide a 'set parents' form element"),
      '#default_value' => variable_get('og_subgroups_' . $child_type . '_set_parents', 1),
    );
    $form['og_subgroups_settings']['og_subgroups_parent_children_types']['og_subgroups_child_' . $child_type]['og_subgroups_form_settings_' . $child_type]['og_subgroups_' . $child_type . '_set_members'] = array(
      '#type' => 'checkbox',
      '#title' => t("Provide a 'set members' form element"),
      '#default_value' => variable_get('og_subgroups_' . $child_type . '_set_members', 1),
    );
    $other_og_types = $og_types;
    $form['og_subgroups_settings']['og_subgroups_parent_children_types']['og_subgroups_child_' . $child_type]['og_subgroups_' . $child_type . '_parents'] = array(
      '#type' => 'select',
      '#multiple' => TRUE,
      '#options' => $other_og_types,
      '#validate' => array(
        'og_subgroups_parent_types_validate' => array(),
      ),
      '#title' => t('Parent Types'),
      '#default_value' => variable_get('og_subgroups_' . $child_type . '_parents', $og_other_types),
    );
  }
  return system_settings_form($form);
}