You are here

function money_conversion_dialog_add_js in Money field 6

Helper function to add javascript/stylesheet components.

1 call to money_conversion_dialog_add_js()
theme_money_conversion_dialog in modules/money_conversion_dialog/money_conversion_dialog.module
Display a CCK Money field with currency conversion dialog.

File

modules/money_conversion_dialog/money_conversion_dialog.module, line 101
Provides a 'Click to convert!' addon for Money CCK fields.

Code

function money_conversion_dialog_add_js() {
  static $ready;
  if (!isset($ready)) {
    $ready = TRUE;

    // Add jQuery UI Dialog widget.
    jquery_ui_add(array(
      'ui.dialog',
      'ui.draggable',
    ));

    // Reuse ajax functionality in Drupal's autocomplete behavior.
    drupal_add_js('misc/autocomplete.js');

    // Add our own stylesheet/javascript.
    $module_path = drupal_get_path('module', 'money_conversion_dialog');
    $settings = array(
      'uri' => url('money-conversion-dialog', array(
        'absolute' => TRUE,
      )),
      'path' => base_path() . $module_path,
    );
    drupal_add_css($module_path . '/money_conversion_dialog.css');
    drupal_add_js($module_path . '/money_conversion_dialog.js');
    drupal_add_js(array(
      'moneyConversionDialog' => $settings,
    ), 'setting');
  }
}