Removing block types from TYPO3 RTE

Friday, September 28th, 2012 at 2045

When configuring the TYPO3 RTE, it’s a common requirement to restrict the tags available to the editor. The RTE has dropdowns for block types which, by default, contains everything from p, through h1…h6, section, aside and so on… Not good news if you’ve got creative editors.

Removing these involved digging into the source here http://typo3.org/api/typo3/class_8tx__rtehtmlarea__blockelements_8php_source.html to discover a seemingly undocumented property in the RTE.

You can set this up as follows in your Page TS:

RTE { 
    default {
        buttons.formatblock.removeItems = h1,h5,h5,pre
    }
}

If anyone finds this, and wants a more detailed guide on adding and controlling the custom classes in the RTE, just shout loudly in the comments! Best of luck keeping your editors under control 😀

UPDATE: Also, watch out to make sure you’re reading the most up to date version of the RTE manual… DOH. I was reading an outdated one, which did not document the above. The current RTE manual can be found here, and outlines this feature. Always watch out for that, the Typo3 documentation can be a bit of a maze!

3 Comment for “Removing block types from TYPO3 RTE”

  1. takov Said this on

    Thanks! It works.

    But I want also to rename some of the items. For example, the “h5″ to be shown in the editor as “Head 5″. Now it is “Heading 5″.

    Could it be made by TS config also?

  2. Denyerec Said this on

    The manual says “buttons.formatblock.items.[item-name].label” can be used to change the visual label of the formatblock item. Give that a try with :

    buttons.formatblock.items.heading5.label = Head 5
    

    And see if it works.

  3. Michael Said this on

    Cool! Works perfectly fine – even in TYPO3 CMS 6.1.x :-) Thanks for sharing this with the community, dude.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>