You are here

function ace_editor_add_js in Ace Code Editor 7

Add all JavaScript needed for the editor to work on the next page.

4 calls to ace_editor_add_js()
ace_editor_add in ./ace_editor.module
An API function to embed read-only editors into template files.
ace_editor_field_formatter_view in ./ace_editor.module
Implements hook_field_formatter_view().
ace_editor_filter_process in ./ace_editor.module
Implements hook_filter_FILTER_prepare().
ace_editor_node_block_edit_form_attach_js in ./ace_editor.module
Add JS to the page containing the affected forms.

File

./ace_editor.module, line 477
Ace Editor module.

Code

function ace_editor_add_js($add_js_settings, $for_admin_pages) {
  drupal_add_library('ace_editor', 'ace', FALSE);
  global $base_path;
  $ace_lib_path = libraries_get_path('ace');
  if (isset($add_js_settings[0]) && is_array($add_js_settings[0])) {
    foreach ($add_js_settings as $key => $settings) {
      drupal_add_js($ace_lib_path . '/src/theme-' . $settings['theme'] . '.js', array(
        'preprocess' => FALSE,
      ));
      drupal_add_js($ace_lib_path . '/src/mode-' . $settings['syntax'] . '.js', array(
        'preprocess' => FALSE,
      ));
    }
  }
  else {
    drupal_add_js($ace_lib_path . '/src/theme-' . $add_js_settings['theme'] . '.js', array(
      'preprocess' => FALSE,
    ));
    drupal_add_js($ace_lib_path . '/src/mode-' . $add_js_settings['syntax'] . '.js', array(
      'preprocess' => FALSE,
    ));
  }
  if ($for_admin_pages) {
    drupal_add_library('system', 'ui.resizable');
  }
}