summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsun2008-11-03 21:13:21 (GMT)
committer sun2008-11-03 21:13:21 (GMT)
commitc089023a07ff114e193e1998ae776b1cf7567fe9 (patch)
treeb0bf9ee3ad6a6677147b4697fd25d3c102e7cf2d
parentfe6b52349c4ba2146079033088eb22b57096f9e8 (diff)
#329410 by sun: Fixed editor not loaded if there is only one input format.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--wysiwyg.module12
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1e3cfb7..3ccc7c2 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 5.x-x.x, xxxx-xx-xx
---------------------------
+#329410 by sun: Fixed editor not loaded if there is only one input format.
#324366 by sun: Fixed "Illegal offset type" error on custom content-types.
#328948 by sun: Fixed PHP notices when editors are assigned, but not configured.
#327710 by sun: Fixed nicEdit version could not be detected.
diff --git a/wysiwyg.module b/wysiwyg.module
index db919c8..2c4bf65 100644
--- a/wysiwyg.module
+++ b/wysiwyg.module
@@ -134,7 +134,9 @@ function wysiwyg_process_form(&$form) {
// guidelines, stored in the child 'format'.
$formats = element_children($element);
array_pop($formats);
- unset($formats['format']);
+ if (($key = array_search('format', $formats)) !== FALSE) {
+ unset($formats[$key]);
+ }
foreach ($formats as $format) {
// Default to 'none' editor (Drupal's default behaviors).
$editor = 'none';
@@ -157,8 +159,12 @@ function wysiwyg_process_form(&$form) {
// Use a prefix/suffix for a single input format, or attach to input
// format selector radio buttons.
if (isset($element['format']['guidelines'])) {
- $element[$format]['#prefix'] = '<div class="wysiwyg wysiwyg-editor-'. $editor .' wysiwyg-field-'. $field['#id'] . $theme . $extra_class .'">';
- $element[$format]['#suffix'] = '</div>';
+ $element['format']['guidelines']['#prefix'] = '<div class="wysiwyg wysiwyg-editor-'. $editor .' wysiwyg-field-'. $field['#id'] . $theme . $extra_class .'">';
+ $element['format']['guidelines']['#suffix'] = '</div>';
+ // Edge-case: Default format contains no input filters.
+ if (empty($element['format']['guidelines']['#value'])) {
+ $element['format']['guidelines']['#value'] = ' ';
+ }
}
else {
if (isset($element[$format]['#attributes']['class'])) {