function logintoboggan_unified_login_form in LoginToboggan 7
Builds a unified login form.
Parameters
$active_form: Which form to display, should be 'login' or 'register'.
1 call to logintoboggan_unified_login_form()
- logintoboggan_get_authentication_form in ./
logintoboggan.module - Returns an appropriate authentication form based on the configuration.
File
- ./
logintoboggan.module, line 897 - LoginToboggan module
Code
function logintoboggan_unified_login_form($active_form = 'login') {
$login_form = drupal_get_form('user_login');
$register_form = drupal_get_form('user_register_form');
// Override the default form tab if the user has been sent to the page via a
// failed log-in or registration attempt.
if (!empty($register_form['#validated'])) {
$active_form = 'register';
}
else {
if (!empty($login_form['#validated'])) {
$active_form = 'login';
}
}
$login_form['#attached']['js'][] = drupal_get_path('module', 'logintoboggan') . '/logintoboggan.unifiedlogin.js';
$login_form['#attached']['js'][] = array(
'data' => array(
'LoginToboggan' => array(
'unifiedLoginActiveForm' => $active_form,
),
),
'type' => 'setting',
);
$rendered_login_form = drupal_render($login_form);
$rendered_register_form = drupal_render($register_form);
$variables = array(
'login_form' => $rendered_login_form,
'register_form' => $rendered_register_form,
'active_form' => $active_form,
);
$output = theme('lt_unified_login_page', $variables);
return $output;
}