You are here

function shib_auth_profile_form_field_ui_field_edit_form_alter in Shibboleth Authentication 7.4

Implements hook_form_FORM_ID_alter().

File

shib_auth_profile/shib_auth_profile.module, line 26
Drupal Shibboleth authentication profile module.

Code

function shib_auth_profile_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
  $field = $form['#field'];
  $inst = $form['#instance'];
  if ($inst['entity_type'] == 'user' && !empty($field['columns']['value'])) {
    $form['instance']['settings']['shib_auth_profile']['mode'] = array(
      '#type' => 'select',
      '#title' => t('Shibboleth values'),
      '#options' => array(
        '' => t('Disabled'),
        'editable' => t('Initial value from Shibboleth, later editable by User'),
        'auto_update' => t('Always update value on User login, not editable by user'),
      ),
      '#default_value' => @$form['#instance']['settings']['shib_auth_profile']['mode'],
    );
    $form['instance']['settings']['shib_auth_profile']['server_variables'] = array(
      '#type' => 'textfield',
      '#title' => t('Server variable names'),
      '#default_value' => @$form['#instance']['settings']['shib_auth_profile']['server_variables'],
      '#description' => t('Server variable names in brackets, like: <em>[eppn]</em>. Available variables: <a href="@url">PHP Info</a>', array(
        '@url' => url('admin/reports/status/php/'),
      )),
      '#states' => array(
        'invisible' => array(
          ':input[name="instance[settings][shib_auth_profile][mode]"]' => array(
            'value' => '',
          ),
        ),
      ),
    );
  }
}