You are here

function mass_contact_role_admin_edit_submit in Mass Contact 7

Category add/edit form submit callback.

Returns the piece of data that will be saved to mass_contact table in recepients field.

Parameters

array $form: A nested array of form elements that comprise the form.

array $form_state: A keyed array containing the current state of the form.

Return value

array An array of role IDs.

1 string reference to 'mass_contact_role_admin_edit_submit'
mass_contact_role.inc in plugins/mass_contact_role.inc

File

plugins/mass_contact_role.inc, line 183

Code

function mass_contact_role_admin_edit_submit(array $form, array &$form_state) {
  $roles = $form_state['values']['recipients']['mass_contact_role'];

  // If all authenticated users are already added, simply return the
  // authenticated users' rid.
  if ($roles[2] == 2) {
    return array(
      2,
    );
  }

  // Remove roles that were not selected.
  $roles = array_filter($roles);
  return $roles;
}