function _modal_forms_doheader in Modal forms (with ctools) 6
Same name and namespace in other branches
- 7 modal_forms.module \_modal_forms_doheader()
Loads the various js and css files.
1 call to _modal_forms_doheader()
- modal_forms_init in ./
modal_forms.module - Implements hook_init().
File
- ./
modal_forms.module, line 143 - Modal Forms allows you to activate a Ctools based ajax modal on common Drupal forms
Code
function _modal_forms_doheader() {
static $already_added = FALSE;
// Don't add the JavaScript and CSS multiple times.
if ($already_added) {
return;
}
// Don't add the JavaScript and CSS on specified paths.
if (!_modal_forms_active()) {
return;
}
$throbber = theme('image', ctools_image_path('loading_animation.gif', 'modal_forms'), t('Loading...'), t('Loading'));
$js_settings = array(
'modal-popup-small' => array(
'modalSize' => array(
'type' => 'fixed',
'width' => 300,
'height' => 300,
),
'modalOptions' => array(
'opacity' => 0.85,
'background' => '#000',
),
'animation' => 'fadeIn',
'modalTheme' => 'ModalFormsPopup',
'throbber' => $throbber,
'closeText' => t('Close'),
),
'modal-popup-medium' => array(
'modalSize' => array(
'type' => 'fixed',
'width' => 550,
'height' => 450,
),
'modalOptions' => array(
'opacity' => 0.85,
'background' => '#000',
),
'animation' => 'fadeIn',
'modalTheme' => 'ModalFormsPopup',
'throbber' => $throbber,
'closeText' => t('Close'),
),
'modal-popup-large' => array(
'modalSize' => array(
'type' => 'scale',
'width' => 0.8,
'height' => 0.8,
),
'modalOptions' => array(
'opacity' => 0.85,
'background' => '#000',
),
'animation' => 'fadeIn',
'modalTheme' => 'ModalFormsPopup',
'throbber' => $throbber,
'closeText' => t('Close'),
),
);
drupal_add_js($js_settings, 'setting');
$path = drupal_get_path('module', 'modal_forms');
// Automatically rewrite selected links to open in a modal.
global $user;
if ($user->uid == 0) {
if (variable_get('modal_forms_login', 0)) {
drupal_add_js($path . '/js/modal_forms_login.js');
}
if (variable_get('modal_forms_register', 0)) {
drupal_add_js($path . '/js/modal_forms_register.js');
}
if (variable_get('modal_forms_password', 0)) {
drupal_add_js($path . '/js/modal_forms_password.js');
}
}
if (variable_get('modal_forms_contact', 0)) {
drupal_add_js($path . '/js/modal_forms_contact.js');
}
$already_added = TRUE;
}