You are here

function hybridauth_admin_provider_settings in HybridAuth Social Login 7.2

Same name and namespace in other branches
  1. 6.2 hybridauth.admin.inc \hybridauth_admin_provider_settings()
  2. 7 hybridauth.admin.inc \hybridauth_admin_provider_settings()

Form constructor for the hybridauth provider admin settings form.

See also

hybridauth_admin_provider_settings_validate()

1 string reference to 'hybridauth_admin_provider_settings'
hybridauth_menu in ./hybridauth.module
Implements hook_menu().

File

./hybridauth.admin.inc, line 440
Administrative pages forms and functions for the HybridAuth module.

Code

function hybridauth_admin_provider_settings($form, &$form_state, $provider_id = NULL) {
  $form['vtabs'] = array(
    '#type' => 'vertical_tabs',
  );
  $form['vtabs']['application'] = array(
    '#type' => 'fieldset',
    '#title' => t('Application settings'),
    '#description' => t('Enter the application ID, consumer key, and/or secret key as required.'),
  );
  $form['vtabs']['application']['hybridauth_provider_' . $provider_id . '_keys_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Application ID'),
    '#description' => t('The application ID.'),
    '#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_keys_id', ''),
  );
  $form['vtabs']['application']['hybridauth_provider_' . $provider_id . '_keys_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Application consumer key'),
    '#description' => t('The Application consumer key.'),
    '#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_keys_key', ''),
  );
  $form['vtabs']['application']['hybridauth_provider_' . $provider_id . '_keys_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Application consumer secret'),
    '#description' => t('The application consumer secret key.'),
    '#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_keys_secret', ''),
  );
  $form['vtabs']['window_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Authentication window settings'),
  );
  $options = array(
    'current' => t('Current window'),
    'popup' => t('New popup window'),
  );
  $modal_description = FALSE;
  if (module_exists('colorbox')) {
    $options['colorbox'] = t('Colorbox');
    $modal_description = TRUE;
  }
  if (module_exists('shadowbox')) {
    $options['shadowbox'] = t('Shadowbox');
    $modal_description = TRUE;
  }
  if (module_exists('fancybox')) {
    $options['fancybox'] = t('fancyBox');
    $modal_description = TRUE;
  }
  if (module_exists('lightbox2')) {
    $options['lightbox2'] = t('Lightbox2');
    $modal_description = TRUE;
  }
  $form['vtabs']['window_settings']['hybridauth_provider_' . $provider_id . '_window_type'] = array(
    '#type' => 'radios',
    '#title' => t('Authentication window type'),
    '#options' => $options,
    '#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_window_type', 'current'),
    '#description' => $modal_description ? t("Be careful with modal windows - some authentication providers (Twitter, LinkedIn) won't work with them.") : '',
  );
  $base = array(
    '#type' => 'textfield',
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
    '#size' => 4,
    '#maxlength' => 4,
    '#states' => array(
      'invisible' => array(
        ':input[name="hybridauth_provider_' . $provider_id . '_window_type"]' => array(
          'value' => 'current',
        ),
      ),
    ),
  );
  $form['vtabs']['window_settings']['hybridauth_provider_' . $provider_id . '_window_width'] = array(
    '#title' => t('Width'),
    '#description' => t('Authentication window width (pixels).'),
    '#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_window_width', 800),
  ) + $base;
  $form['vtabs']['window_settings']['hybridauth_provider_' . $provider_id . '_window_height'] = array(
    '#title' => t('Height'),
    '#description' => t('Authentication window height (pixels).'),
    '#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_window_height', 500),
  ) + $base;
  if ($provider = hybridauth_get_provider($provider_id)) {
    if ($function = ctools_plugin_get_function($provider, 'configuration_form_callback')) {
      $function($form, $provider_id);
    }
  }
  return system_settings_form($form);
}