You are here

function finder_user_form_finder_admin_element_edit_alter in Finder 7

Same name and namespace in other branches
  1. 6 modules/finder_user/finder_user.module \finder_user_form_finder_admin_element_edit_alter()

Implements hook_form_FORM_ID_alter().

See also

hook_form_FORM_ID_alter()

File

modules/finder_user/finder_user.module, line 46
The finder user module.

Code

function finder_user_form_finder_admin_element_edit_alter(&$form, $form_state) {
  $finder =& $form_state['storage']['finder'];
  if ($finder->base == 'user') {
    $element =& $form_state['storage']['finder_element_defaults'];
    $roles = finder_user_get_roles();
    if ($roles) {
      $form['settings']['choices']['user_roles'] = array(
        '#type' => 'select',
        '#title' => t('Restrict users that can be found to only these user roles'),
        '#default_value' => $element->settings['choices']['user_roles'],
        '#options' => $roles,
        '#description' => t('If no user role is selected, users of all roles will be displayed.'),
        '#multiple' => TRUE,
        '#size' => min(6, count($roles) + 1),
        '#weight' => 10,
      );
    }
    else {
      $form['settings']['choices']['no_roles'] = array(
        '#value' => t("<em>There are currently no user roles to choose from.</em>"),
        '#weight' => 10,
      );
    }
    $form['settings']['choices']['active'] = array(
      '#type' => 'checkbox',
      '#title' => t('Active'),
      '#default_value' => $element->settings['choices']['active'],
      '#weight' => 90,
      '#description' => t('Only show users that are active.'),
    );
    $form['settings']['choices']['per_result'] = array(
      '#type' => 'checkbox',
      '#title' => t('Choices per result'),
      '#default_value' => $element->settings['choices']['per_result'],
      '#weight' => 110,
      '#description' => t('Forces finder to internally process a choice for each potential result user.'),
    );
  }
}