#775952 Got an E_NOTICE error from fckeditor_process_form()
authorJorrit Schippers
Tue, 8 Jun 2010 13:22:08 +0000 (13:22 +0000)
committerJorrit Schippers
Tue, 8 Jun 2010 13:22:08 +0000 (13:22 +0000)
CHANGELOG.txt
fckeditor.module

index 94ec97a..66c79b1 100644 (file)
@@ -1,5 +1,8 @@
 $Id$
 
+-- 2010-06-08 version 6.x-2.x-dev
+* #775952 Got an E_NOTICE error from fckeditor_process_form()
+
 -- 2010-03-13 version 6.x-2.x-dev
 * #726536 Save button in toolbar
 * #705468 Insert View & Insert Block filters tags not preserved when editing saved nodes
index e3a8ddb..f777382 100644 (file)
@@ -184,50 +184,54 @@ function fckeditor_process_form(&$form) {
           // The element before this element is the target form field.
           $field = &$form[$children[$index - 1]];
           $textarea_id = $field['#id'];
-          $js_id = $_fckeditor_js_ids[$textarea_id];
 
-          array_push($processed_textareas, $js_id);
+          // The following condition may fail when there are textareas with formats that do not have FCKeditor enabled.
+          if (isset($_fckeditor_js_ids[$textarea_id])) {
+            $js_id = $_fckeditor_js_ids[$textarea_id];
 
-          //search for checkxss1/2 class
-          if (empty($field['#attributes']['class']) || strpos($field['#attributes']['class'], "checkxss") === FALSE) {
-            continue;
-          }
+            array_push($processed_textareas, $js_id);
 
-          // Determine the available input formats. The last child element is a
-          // link to "More information about formatting options". When only one
-          // input format is displayed, we also have to remove formatting
-          // guidelines, stored in the child 'format'.
-          $formats = element_children($element);
+            //search for checkxss1/2 class
+            if (empty($field['#attributes']['class']) || strpos($field['#attributes']['class'], "checkxss") === FALSE) {
+              continue;
+            }
 
-          foreach ($formats as $format_id) {
-            $format = !empty($element[$format_id]['#default_value']) ? $element[$format_id]['#default_value'] : $element[$format_id]['#value'];
-            break;
-          }
+            // Determine the available input formats. The last child element is a
+            // link to "More information about formatting options". When only one
+            // input format is displayed, we also have to remove formatting
+            // guidelines, stored in the child 'format'.
+            $formats = element_children($element);
 
-          $enabled = filter_list_format($format);
-          $fckeditor_filters = array();
+            foreach ($formats as $format_id) {
+              $format = !empty($element[$format_id]['#default_value']) ? $element[$format_id]['#default_value'] : $element[$format_id]['#value'];
+              break;
+            }
 
-          //loop through all enabled filters
-          foreach ($enabled as $id => $filter) {
-            //but use only that one selected in FCKeditor profile
-            if (in_array($id, array_keys($_fckeditor_configuration[$textarea_id]['filters'])) && $_fckeditor_configuration[$textarea_id]['filters'][$id]) {
-              if (!isset($fckeditor_filters[$js_id])) {
-                $fckeditor_filters[$js_id] = array();
+            $enabled = filter_list_format($format);
+            $fckeditor_filters = array();
+
+            //loop through all enabled filters
+            foreach ($enabled as $id => $filter) {
+              //but use only that one selected in FCKeditor profile
+              if (in_array($id, array_keys($_fckeditor_configuration[$textarea_id]['filters'])) && $_fckeditor_configuration[$textarea_id]['filters'][$id]) {
+                if (!isset($fckeditor_filters[$js_id])) {
+                  $fckeditor_filters[$js_id] = array();
+                }
+                $fckeditor_filters[$js_id][] = $id ."/". $format;
               }
-              $fckeditor_filters[$js_id][] = $id ."/". $format;
             }
-          }
 
-          //No filters assigned, remove xss class
-          if (empty($fckeditor_filters[$js_id])) {
-            $field['#attributes']['class'] = preg_replace("/checkxss(1|2)/", "", $field['#attributes']['class']);
-          }
-          else {
-            $field['#attributes']['class'] = strtr($field['#attributes']['class'], array("checkxss1" => "filterxss1", "checkxss2" => "filterxss2"));
-          }
+            //No filters assigned, remove xss class
+            if (empty($fckeditor_filters[$js_id])) {
+              $field['#attributes']['class'] = preg_replace("/checkxss(1|2)/", "", $field['#attributes']['class']);
+            }
+            else {
+              $field['#attributes']['class'] = strtr($field['#attributes']['class'], array("checkxss1" => "filterxss1", "checkxss2" => "filterxss2"));
+            }
 
-          array_pop($formats);
-          unset($formats['format']);
+            array_pop($formats);
+            unset($formats['format']);
+          }
         }
         // If this element is 'format', do not recurse further.
         continue;