You are here

function _spaces_form_alter_group in Spaces 5

1 call to _spaces_form_alter_group()
spaces_form_alter in ./spaces.module

File

./spaces.module, line 222

Code

function _spaces_form_alter_group(&$form) {
  _spaces_make_hidden($form['og_selective']);
  _spaces_make_hidden($form['og_register']);
  _spaces_make_hidden($form['og_private']);
  _spaces_make_hidden($form['og_directory']);
  switch (variable_get('context_prefix_method_spaces', CONTEXT_PREFIX_PATH)) {
    case CONTEXT_PREFIX_PATH:
      $description = t('Choose a prefix path for this Spaces group. May contain only lowercase letters, numbers, dashes and underscores. e.g. "development-seed"');
      break;
    case CONTEXT_PREFIX_SUBDOMAIN:
      $description = t('Enter a domain registered for this group, such as "mygroup".  Do not include http://');
      break;
    case CONTEXT_PREFIX_DOMAIN:
      $description = t('Enter a domain registered for this group, such as "www.example.com".  Do not include http://');
      break;
  }
  $form['spaces_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Group Path'),
    '#description' => $description,
    '#required' => true,
    '#disabled' => user_access('administer group features') ? false : true,
    '#default_value' => spaces_group_path($form['#node']->nid) ? spaces_group_path($form['#node']->nid) : '',
  );

  // Add group mask options
  if ($form['#node']) {
    $og_settings = array(
      'og_selective' => $form['#node']->og_selective,
      'og_directory' => $form['#node']->og_directory,
      'og_register' => $form['#node']->og_register,
      'og_private' => $form['#node']->og_private,
    );
    $default_privacy = spaces_groupmask('check', $og_settings);
  }
  $form['spaces_groupmask'] = array(
    '#required' => true,
    '#type' => 'select',
    '#title' => t('Group Privacy'),
    '#options' => spaces_groupmask('labels'),
    '#description' => t('<strong>Private</strong> groups are invisible to the public and accessible only by members.<br/><strong>Controlled</strong> groups are visible to the public, but cannot be joined without approval.<br/><strong>Public</strong> groups are visible to the public and can be joined by site members.'),
    '#default_value' => $default_privacy ? $default_privacy : 'private',
    '#disabled' => user_access('administer group features') ? false : true,
  );
  $form['#after_build'][] = 'spaces_group_after_build';
}