You are here

function wysiwyg_add_editor_settings in Wysiwyg 5.2

Same name and namespace in other branches
  1. 5 wysiwyg.module \wysiwyg_add_editor_settings()
  2. 6.2 wysiwyg.module \wysiwyg_add_editor_settings()
  3. 6 wysiwyg.module \wysiwyg_add_editor_settings()
  4. 7.2 wysiwyg.module \wysiwyg_add_editor_settings()

Add editor settings for a given input format.

1 call to wysiwyg_add_editor_settings()
wysiwyg_process_form in ./wysiwyg.module
Process a textarea for Wysiwyg Editor.

File

./wysiwyg.module, line 333
Integrate client-side editors with Drupal.

Code

function wysiwyg_add_editor_settings($profile, $theme) {
  static $formats = array();
  if (!isset($formats[$profile->format])) {
    $config = wysiwyg_get_editor_config($profile, $theme);

    // drupal_to_js() does not properly convert numeric array keys, so we need
    // to use a string instead of the format id.
    if ($config) {
      drupal_add_js(array(
        'wysiwyg' => array(
          'configs' => array(
            $profile->editor => array(
              'format' . $profile->format => $config,
            ),
          ),
        ),
      ), 'setting');
    }
    $formats[$profile->format] = TRUE;
  }
}