You are here

function hybridauth_admin_widget_settings in HybridAuth Social Login 7

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

File

./hybridauth.admin.inc, line 227

Code

function hybridauth_admin_widget_settings() {
  $form = array();
  module_load_include('inc', 'hybridauth', 'hybridauth.auth');
  $form['hybridauth_widget_attach_loginform'] = array(
    '#type' => 'checkbox',
    '#title' => t('Attach login widget to login form'),
    '#description' => t('Should we add the social login widget to the login forms?'),
    '#default_value' => variable_get('hybridauth_widget_attach_loginform', FALSE),
  );
  $form['loginform'] = array(
    '#type' => 'fieldset',
    '#title' => t('Login form options'),
    '#states' => array(
      'invisible' => array(
        ':input[name="hybridauth_widget_attach_loginform"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['loginform']['hybridauth_widget_attach_loginform_wrapper_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Wrapper title'),
    '#default_value' => variable_get('hybridauth_widget_attach_loginform_wrapper_title', HYBRIDAUTH_WIDGET_ATTACH_LOGINFORM_WRAPPER_TITLE_DEFAULT),
  );
  $options = array(
    'list' => t('Providers: Display provider links and icons.'),
    'button' => t('Single Button: Display a single button that leads to a page of providers and icons.'),
    'link' => t('Single Link: Display a single link that leads to a page of providers and icons.'),
  );
  $form['loginform']['hybridauth_widget_attach_loginform_style'] = array(
    '#type' => 'select',
    '#title' => t('Attachment Style'),
    '#options' => $options,
    '#default_value' => variable_get('hybridauth_widget_attach_loginform_style', HYBRIDAUTH_WIDGET_ATTACH_LOGINFORM_STYLE_DEFAULT),
  );
  $form['loginform']['hybridauth_widget_attach_loginform_icon_size'] = array(
    '#type' => 'select',
    '#title' => t('Icon Size'),
    '#options' => array(
      '32' => '32px',
      '48' => '48px',
      '64' => '64px',
    ),
    '#default_value' => variable_get('hybridauth_widget_attach_loginform_icon_size', HYBRIDAUTH_WIDGET_ATTACH_LOGINFORM_ICON_SIZE_DEFAULT),
    '#states' => array(
      'invisible' => array(
        ':input[name="hybridauth_widget_attach_loginform_style"]' => array(
          'value' => 'link',
        ),
      ),
    ),
  );
  $form['loginform']['hybridauth_widget_attach_loginform_link_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Link title'),
    '#default_value' => variable_get('hybridauth_widget_attach_loginform_link_title', HYBRIDAUTH_WIDGET_ATTACH_LOGINFORM_LINK_TITLE_DEFAULT),
    '#states' => array(
      'visible' => array(
        ':input[name="hybridauth_widget_attach_loginform_style"]' => array(
          'value' => 'link',
        ),
      ),
    ),
  );
  $form['loginform']['hybridauth_widget_attach_loginform_link_alt'] = array(
    '#type' => 'textfield',
    '#title' => t('Link alt'),
    '#default_value' => variable_get('hybridauth_widget_attach_loginform_link_alt', HYBRIDAUTH_WIDGET_ATTACH_LOGINFORM_LINK_ALT_DEFAULT),
    '#states' => array(
      'visible' => array(
        ':input[name="hybridauth_widget_attach_loginform_style"]' => array(
          'value' => 'link',
        ),
      ),
    ),
  );
  $form['hybridauth_widget_use_overlay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display widget pages in an overlay'),
    '#description' => t('This requires the colorbox module.'),
    '#default_value' => variable_get('hybridauth_widget_use_overlay', HYBRIDAUTH_WIDGET_USE_OVERLAY_DEFAULT),
    '#disabled' => !module_exists('colorbox'),
  );
  return system_settings_form($form);
}