You are here

function spaces_group_after_build in Spaces 5

Overrides og_selective and og_directory options based on whether a group is public/private

1 string reference to 'spaces_group_after_build'
_spaces_form_alter_group in ./spaces.module

File

./spaces.module, line 386

Code

function spaces_group_after_build($form, $form_values) {
  $mask = spaces_groupmask('mask');
  $privacy = $form_values['spaces_groupmask'];
  if ($privacy && isset($mask[$privacy]['mask'])) {
    foreach ($mask[$privacy]['mask'] as $key => $value) {

      // Need to add a parents key, otherwise form_set_value() cries foul.
      if (!isset($form[$key]['#parents'])) {
        $form[$key]['#parents'] = array();
      }
      form_set_value($form[$key], $value);
    }
  }
  return $form;
}