4

Using this tip I was previously hiding the text format options with

$form['und'][0]['format']['#access'] = FALSE; 

When I enabled WYSIWYG it wouldn't show the editor and I had to use

$form['und'][0]['format']['format']['#access'] = FALSE;
$form['und'][0]['format']['guidelines']['#access'] = FALSE; 
$form['und'][0]['format']['help']['#access'] = FALSE; 

What's left now is this bottom box (below Path: p...) enter image description here

This is the HTML that's generating it:

<fieldset class="filter-wrapper form-wrapper" id="edit-comment-body-und-0-format">
    <div class="fieldset-wrapper"><input id="edit-comment-body-und-0-format--2" class="wysiwyg wysiwyg-processed" type="hidden" name="comment_body[und][0][format]" value="filtered_html"></div>
</fieldset>

I could hide it with CSS. How would I hide it with code similar to above? Btw, I'm aware of Better Formats module but don't want to use it just for that.

3

Try unsetting the field elements. According to the blog post this kills TinyMCE

<?php
  function [theme_name]_form_comment_form_alter(&$form, &$form_state, $form_id)
  {
    $form['comment_body']['#after_build'][] = 'remove_tips';
  }

  function remove_tips(&$form)
  {
    unset($form['und'][0]['format']['guidelines']);
    unset($form['und'][0]['format']['help']);
    return $form;
  }
?>

source: technonaturalist

2
  • thanks, but I need TinyMCE to render, just not the extra fieldset
    – uwe
    May 6 '12 at 0:06
  • 2
    Looks like the Better Formats module just sets the inline style property to display: none. It does reconstruct the whole filter widget into two parts which might be what preserves the WYSIWYG code through intercepting and altering $type['text_format']['#process'] to pointing to its own process function copying mostly from the Drupal core filter_process_format($element). Since most news editors I work with make a massive mess using WYSIWYG they now only get BUEditor which works will with removing the filter wrapper fieldset.
    – Adam S
    May 6 '12 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.