function ctools_ajax_sample_login
A modal login callback.
1 string reference to 'ctools_ajax_sample_login'
- ctools_ajax_sample_menu in ctools_ajax_sample/
ctools_ajax_sample.module - Implementation of hook_menu()
File
-
ctools_ajax_sample/
ctools_ajax_sample.module, line 258
Code
function ctools_ajax_sample_login($js = NULL) {
// Fall back if $js is not set.
if (!$js) {
return drupal_get_form('user_login');
}
ctools_include('modal');
ctools_include('ajax');
$form_state = array(
'title' => t('Login'),
'ajax' => TRUE,
);
$output = ctools_modal_form_wrapper('user_login', $form_state);
if (!empty($form_state['executed'])) {
// We'll just overwrite the form output if it was successful.
$output = array();
$inplace = ctools_ajax_text_button(t('remain here'), 'ctools_ajax_sample/nojs/login/inplace', t('Go to your account'));
$account = ctools_ajax_text_button(t('your account'), 'ctools_ajax_sample/nojs/login/user', t('Go to your account'));
$output[] = ctools_modal_command_display(t('Login Success'), '<div class="modal-message">Login successful. You can now choose whether to ' . $inplace . ', or go to ' . $account . '.</div>');
}
print ajax_render($output);
exit;
}