You are here

function _smiley_add_files in Smiley 6

1 call to _smiley_add_files()
smiley_form_alter in ./smiley.module
Implementation of hook_form_alter().

File

./smiley.module, line 118

Code

function _smiley_add_files() {
  static $files_added = FALSE;
  if (!$files_added) {

    // Add the JS and CSS
    $path = drupal_get_path('module', 'smiley');
    $dialog = variable_get('smiley_enable_dialog', TRUE);
    $draggable = variable_get('smiley_dialog_draggable', FALSE);
    $resizable = variable_get('smiley_dialog_resizable', FALSE);
    $width = variable_get('smiley_dialog_width', 400);
    $height = variable_get('smiley_dialog_height', 0);
    $jquery_ui = module_exists('jquery_ui');
    drupal_add_css($path . '/scripts/smiley.css');
    drupal_add_js(array(
      'smiley' => array(
        'enable_dialog' => $dialog,
        'draggable' => $draggable,
        'resizable' => $resizable,
        'dialog_width' => $width,
        'dialog_height' => $height,
      ),
    ), 'setting');
    drupal_add_js($path . '/scripts/smiley.js');
    if ($dialog) {
      $jquery_ui ? jquery_ui_add('ui.dialog') : drupal_add_js($path . '/scripts/ui.core.dialog.js');
    }
    if ($draggable) {
      $jquery_ui ? jquery_ui_add('ui.draggable') : drupal_add_js($path . '/scripts/ui.draggable.js');
    }
    if ($resizable) {
      $jquery_ui ? jquery_ui_add('ui.resizable') : drupal_add_js($path . '/scripts/ui.resizable.js');
    }
  }
}