home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (jwysiwyg.js)

This example Drupal source code file (jwysiwyg.js) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

editor, field, function, if, jquery, params, php, settings, typeof, undefined, var

The jwysiwyg.js Drupal example source code

// $Id: jwysiwyg.js,v 1.4 2009/09/26 05:37:57 sun Exp $
(function($) {

/**
 * Attach this editor to a target element.
 */
Drupal.wysiwyg.editor.attach.jwysiwyg = function(context, params, settings) {
  // Attach editor.
  $('#' + params.field).wysiwyg();
};

/**
 * Detach a single or all editors.
 */
Drupal.wysiwyg.editor.detach.jwysiwyg = function(context, params) {
  var $field = $('#' + params.field);
  var editor = $field.data('wysiwyg');
  if (typeof editor != 'undefined') {
    editor.saveContent();
    editor.element.remove();
  }
  $field.removeData('wysiwyg');
  $field.show();
};

})(jQuery);

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal jwysiwyg.js source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.