Commit b65f61fd authored by webchick's avatar webchick

Issue #2098071 by Wim Leers, Bojhan: Disable filter guidelines for a text...

Issue #2098071 by Wim Leers, Bojhan: Disable filter guidelines for a text format if that text format has a text editor enabled.
parent 0f29d67b
......@@ -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');
......
......@@ -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;
}
......
......@@ -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();
}
......
......@@ -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,
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment