3 require_once('HTML/QuickForm/textarea.php');
6 * HTML Quickform element for TinyMCE Editor
8 * TinyMCE is a WYSIWYG HTML editor which can be obtained from
9 * http://tinymce.moxiecode.com/.
13 class HTML_QuickForm_DrupalWysiwyg
extends HTML_QuickForm_textarea
21 * @param string TinyMCE instance name
22 * @param string TinyMCE instance label
23 * @param array Config settings for TinyMCE
24 * @param string Attributes for the textarea
28 function HTML_QuickForm_DrupalWysiwyg($elementName=null, $elementLabel=null, $attributes=null, $options=array())
30 HTML_QuickForm_element
::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
31 $this->_persistantFreeze
= true;
32 $this->_type
= 'DrupalWysiwyg';
37 * Called by HTML_QuickForm whenever form event is made on this element
39 * @param string $event Name of event
40 * @param mixed $arg event arguments
41 * @param object &$caller calling object
46 function onQuickFormEvent($event, $arg, &$caller)
50 civicrm_drupal_wysiwyg_update_value($this, $caller);
53 $format = $arg[0] . '_format';
54 $this->format
= $caller->get($format);
55 if (!$this->format
) $this->format
= variable_get('civicrm_wysiwyg_input_format', (defined('FILTER_FORMAT_DEFAULT')?FILTER_FORMAT_DEFAULT
:null));
56 $caller->set($format, $this->format
);
57 parent
::onQuickFormEvent($event, $arg, $caller);
60 parent
::onQuickFormEvent($event, $arg, $caller);
63 } // end func onQuickFormLoad
66 * Return the htmlarea in HTML
74 // return frozen state
75 if ($this->_flagFrozen
) {
76 return $this->getFrozenHtml();
78 $html = civicrm_drupal_get_wysiwyg_html($this->_attributes
, $this->getValue(), $this->format
);
79 return '<div class="civicrm-drupal-wysiwyg">' . $html . '</div>';
83 function exportValue(&$submitValues, $assoc = false) {
84 return $this->_prepareValue($this->getValue(), $assoc);
88 * Returns the htmlarea content in HTML
93 function getFrozenHtml()
95 return $this->getValue();