You are here

function _ajax_register_include_modal in Ajax Login/Register 7.4

Add css and javascript for modal dialog.

2 calls to _ajax_register_include_modal()
ajax_register_block_view in ./ajax_register.module
Implements hook_block_view().
ajax_register_form_alter in ./ajax_register.module
Implements hook_form_alter().

File

./ajax_register.module, line 421

Code

function _ajax_register_include_modal() {
  static $added = FALSE;
  if ($added == FALSE) {

    // Do not add css and scripts again.
    $added = TRUE;

    // Include the CTools tools that we need.
    ctools_include('modal');
    ctools_include('ajax');
    ctools_modal_add_js();

    // Create our own javascript that will be used to theme a modal.
    $ajax_register_style = array(
      'ctools-ajax-register-style' => array(
        'modalSize' => array(
          'type' => 'fixed',
          'width' => (int) trim(variable_get('ajax_register_modal_width', 550)),
          'height' => 140,
          'contentRight' => 30,
          'contentBottom' => 0,
        ),
        'modalOptions' => array(
          'opacity' => (double) variable_get('ajax_register_modal_background_opacity', '0.8'),
          'background-color' => '#' . variable_get('ajax_register_modal_background_color', '000000'),
        ),
        'closeText' => '',
        'throbber' => theme('image', array(
          'path' => ctools_image_path('ajax-loader.gif', 'ajax_register'),
        )),
        'animation' => 'fadeIn',
        'animationSpeed' => 'fast',
      ),
    );

    // Allow other modules to alter modal style.
    drupal_alter('ajax_register_style', $ajax_register_style);
    drupal_add_js($ajax_register_style, 'setting');

    // Add module css and js.
    ctools_add_css('ajax-register', 'ajax_register');
    ctools_add_js('ajax-register', 'ajax_register');
  }
}