You are here

function og_ui_admin_settings in Organic groups 7.2

Menu callback; Admin settings form.

1 string reference to 'og_ui_admin_settings'
og_ui_menu in og_ui/og_ui.module
Implements hook_menu().

File

og_ui/og_ui.admin.inc, line 11
Admin settings for Organic groups module.

Code

function og_ui_admin_settings($form_state) {
  $form = array();
  $form['og_group_manager_full_access'] = array(
    '#type' => 'checkbox',
    '#title' => t('Group manager full permissions'),
    '#description' => t('When enabled the group manager will have all the permissions in the group.'),
    '#default_value' => variable_get('og_group_manager_full_access', TRUE),
  );
  $form['og_node_access_strict'] = array(
    '#type' => 'checkbox',
    '#title' => t('Strict node access permissions'),
    '#description' => t('When enabled Organic groups will restrict permissions for creating, updating and deleting according to the  Organic groups access settings. Example: A content editor with the <em>Edit any page content</em> permission who is not a member of a group would be denied access to modifying page content in that group. (For restricting view access use the Organic groups access control module.)'),
    '#default_value' => variable_get('og_node_access_strict', TRUE),
  );
  $form['og_ui_admin_people_view'] = array(
    '#type' => 'select',
    '#title' => t('Admin people View'),
    '#description' => t('Select the View that should be used to show and control the people in the group.'),
    '#options' => views_get_views_as_options(),
    '#default_value' => variable_get('og_ui_admin_people_view', 'og_members_admin:default'),
    '#required' => TRUE,
  );
  if ($group_bundles = og_get_all_group_bundle()) {
    $form['og_group_manager_rids'] = array(
      '#type' => 'fieldset',
      '#title' => t('Group manager default roles'),
      '#description' => t('Select the role(s) a group manager will be granted upon creating a new group.'),
    );

    // Add group manager default roles.
    $entity_info = entity_get_info();
    foreach ($group_bundles as $entity_type => $bundles) {
      foreach ($bundles as $bundle_name => $bundle_label) {
        $og_roles = og_roles($entity_type, $bundle_name, 0, FALSE, FALSE);
        if (!$og_roles) {
          continue;
        }
        $params = array(
          '@entity-label' => $entity_info[$entity_type]['label'],
          '@bundle-label' => $bundle_label,
        );
        $name = 'og_group_manager_default_rids_' . $entity_type . '_' . $bundle_name;
        $form['og_group_manager_rids'][$name] = array(
          '#type' => 'select',
          '#title' => t('Roles in @entity-label - @bundle-label', $params),
          '#options' => $og_roles,
          '#multiple' => TRUE,
          '#default_value' => variable_get($name, array()),
        );
      }
    }
  }
  $form['og_features_ignore_og_fields'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prevent "Features" export piping'),
    '#description' => t('When exporting a content-type using the Features module, this prevents OG related fields from being exported.'),
    '#default_value' => variable_get('og_features_ignore_og_fields', FALSE),
    '#access' => module_exists('features'),
  );
  $form['og_use_queue'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use queue'),
    '#description' => t("Use the core's queue process to operations such as deleting memberships when groups are deleted."),
    '#default_value' => variable_get('og_use_queue', FALSE),
  );
  $form['og_orphans_delete'] = array(
    '#type' => 'checkbox',
    '#title' => t('Delete orphans'),
    '#description' => t('Delete "Orphan" group-content (not including useres), when the group is deleted.'),
    '#default_value' => variable_get('og_orphans_delete', FALSE),
    '#states' => array(
      'visible' => array(
        ':input[name="og_use_queue"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
    '#attributes' => array(
      'class' => array(
        'entityreference-settings',
      ),
    ),
  );

  // Re-use Entity-reference CSS for indentation.
  $form['#attached']['css'][] = drupal_get_path('module', 'entityreference') . '/entityreference.admin.css';
  return system_settings_form($form);
}