From 4c23c3bcef59753285520b2c5852d18e99fba8a9 Mon Sep 17 00:00:00 2001
From: Eric Rasmussen <eric@unl.edu>
Date: Fri, 30 Mar 2012 16:50:34 +0000
Subject: [PATCH] [gh-306] Merging test into staging -c1489 -c1491

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@1492 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 sites/all/modules/unl/unl.module | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/sites/all/modules/unl/unl.module b/sites/all/modules/unl/unl.module
index 0f75e4f5..d5e86561 100644
--- a/sites/all/modules/unl/unl.module
+++ b/sites/all/modules/unl/unl.module
@@ -206,7 +206,7 @@ function unl_wysiwyg_plugin($editor) {
           'buttons' => array(
             'unlZenBox'   => 'UNL Zen Box',
             'unlZenTable' => 'UNL Zen Table',
-            'unlGrid'   => 'UNL Grid',
+            'unlGrid'     => 'UNL Grid',
             'unlLayout'   => 'UNL Layout',
             'unlTooltip'  => 'UNL Tooltip',
           ),
@@ -216,6 +216,7 @@ function unl_wysiwyg_plugin($editor) {
             'skin' => 'unl',
             'table_styles' => 'ZenTable Bright (yellow)=zentable bright;ZenTable Cool (blue)=zentable cool;ZenTable Energetic (orange)=zentable energetic;ZenTable Soothing (green)=zentable soothing;ZenTable Primary (red)=zentable primary;ZenTable Neutral (gray)=zentable neutral;', 'doctype' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
             'valid_elements' => '*[*],script[charset|defer|id|src|type=text/javascript]',
+            'forced_root_block' => false,
           ),
         )
         // Wysiwyg wrapper plugin AJAX callback.
@@ -228,6 +229,31 @@ function unl_wysiwyg_plugin($editor) {
   }
 }
 
+/**
+ * Implements of hook_element_info_alter().
+ */
+function unl_element_info_alter(&$type) {
+  // Change text format processing on elements to our version.
+  if (isset($type['text_format'])) {
+    $type['text_format']['#process'][] = 'unl_filter_process_format';
+  }
+}
+
+/**
+ * Callback for processing the text_format element
+ */
+function unl_filter_process_format($element) {
+  // Only remove the plain_text and filtered_html options on the node edit form. They need to be available on comment forms, etc.
+  if ($element['#entity_type'] == 'node') {
+    unset($element['format']['format']['#options']['plain_text']);
+    unset($element['format']['format']['#options'][1]); // On production the machine names are integers
+    unset($element['format']['format']['#options']['filtered_html']);
+    unset($element['format']['format']['#options'][11]);
+    $element['format']['format']['#title'] = 'Editor: ';
+  }
+  return $element;
+}
+
 /**
  * Implementation of hook_permission().
  */
-- 
GitLab