You are here

function webform_civicrm_process_group_selection in Webform CiviCRM Integration 7

Same name and namespace in other branches
  1. 6.2 webform_civicrm_admin.inc \webform_civicrm_process_group_selection()
  2. 6 webform_civicrm_forms.inc \webform_civicrm_process_group_selection()
  3. 7.2 webform_civicrm_admin.inc \webform_civicrm_process_group_selection()

Custom Processing for CiviCRM groups form

1 string reference to 'webform_civicrm_process_group_selection'
_webform_civicrm_webform_component_form_alter in ./webform_civicrm_forms.inc
Alter back-end webform component edit forms. Called by hook_form_alter() whenever editing a webform component.

File

./webform_civicrm_forms.inc, line 291

Code

function webform_civicrm_process_group_selection($form, &$form_state) {
  if (!empty($form_state['values']['civicrm_groups_fieldset']['civicrm_groups'])) {
    civicrm_initialize();
    $groups = webform_civicrm_get_options('groups', 'arr');
    $items = '';
    foreach ($form_state['values']['civicrm_groups_fieldset']['civicrm_groups'] as $gid) {
      if ($gid) {
        if ($items) {
          $items .= "\n";
        }
        $items .= $gid . '|' . $groups[$gid];
      }
    }
    $form_state['values']['extra']['items'] = $items;
  }
  $form_state['values']['value'] = '';
  foreach ($form_state['values']['civicrm_groups_fieldset']['civicrm_group_defaults'] as $gid) {
    if (!$gid) {
      continue;
    }
    if (!empty($form_state['values']['value'])) {
      $form_state['values']['value'] .= ',';
    }
    $form_state['values']['value'] .= $gid;
  }
}