From b65f61fdf9aae4aa9e3f1e799b205d8579fbbc5e Mon Sep 17 00:00:00 2001
From: webchick <webchick@24967.no-reply.drupal.org>
Date: Tue, 5 Nov 2013 08:57:56 -0800
Subject: [PATCH] Issue #2098071 by Wim Leers, Bojhan: Disable filter
 guidelines for a text format if that text format has a text editor enabled.

---
 core/modules/editor/editor.module        | 9 ++++++++-
 core/modules/filter/css/filter.admin.css | 8 ++++++--
 core/modules/filter/filter.js            | 2 +-
 core/modules/filter/filter.module        | 2 +-
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index 63641025af60..c1bffd41c74f 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -354,7 +354,8 @@ function editor_pre_render_format($element) {
   $format_ids = array_keys($element['format']['format']['#options']);
 
   // Early-return if no text editor is associated with any of the text formats.
-  if (count(entity_load_multiple('editor', $format_ids)) === 0) {
+  $editors = entity_load_multiple('editor', $format_ids);
+  if (count($editors) === 0) {
     return $element;
   }
 
@@ -379,6 +380,12 @@ function editor_pre_render_format($element) {
     $element['format']['format']['#attributes']['data-editor-for'] = $field_id;
   }
 
+  // Hide the text format's filters' guidelines of those text formats that have
+  // a text editor associated: they're rather useless when using a text editor.
+  foreach ($editors as $format_id => $editor) {
+    $element['format']['guidelines'][$format_id]['#access'] = FALSE;
+  }
+
   // Attach Text Editor module's (this module) library.
   $element['#attached']['library'][] = array('editor', 'drupal.editor');
 
diff --git a/core/modules/filter/css/filter.admin.css b/core/modules/filter/css/filter.admin.css
index 80ad17107102..753dd768933e 100644
--- a/core/modules/filter/css/filter.admin.css
+++ b/core/modules/filter/css/filter.admin.css
@@ -15,10 +15,11 @@
   border: 1px solid #ccc;
   border-top: 0;
   margin: 0;
-  padding: 0.5em 1.5em;
+  padding: 0.5em 0.666em;
+  overflow: hidden;
 }
 .filter-wrapper .form-item {
-  margin-top: 0;
+  margin: 0;
 }
 .filter-wrapper .form-item label {
   display: inline;
@@ -30,6 +31,9 @@
 [dir="rtl"] .filter-help {
   float: left;
 }
+.filter-guidelines .filter-guidelines-item {
+  margin-top: 1em;
+}
 .filter-help p {
   margin: 0;
 }
diff --git a/core/modules/filter/filter.js b/core/modules/filter/filter.js
index 4bc8c18aeeba..4bb10e0bf00a 100644
--- a/core/modules/filter/filter.js
+++ b/core/modules/filter/filter.js
@@ -18,7 +18,7 @@ Drupal.behaviors.filterGuidelines = {
       .bind('change', function () {
         $(this).closest('.filter-wrapper')
           .find('.filter-guidelines-item').hide()
-          .siblings('.filter-guidelines-' + this.value).show();
+          .filter('.filter-guidelines-' + this.value).show();
       })
       .change();
   }
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index a8f2c2e4954d..ba0df51fc546 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -769,7 +769,7 @@ function filter_process_format($element) {
   $element['format']['help'] = array(
     '#type' => 'container',
     '#attributes' => array('class' => array('filter-help')),
-    '#markup' => l(t('More information about text formats'), 'filter/tips', array('attributes' => array('target' => '_blank'))),
+    '#markup' => l(t('About text formats'), 'filter/tips', array('attributes' => array('target' => '_blank'))),
     '#weight' => 0,
   );
 
-- 
GitLab