• Steven Wittens's avatar
    The Input formats - filter patch has landed. I still need to make update... · 660f9928
    Steven Wittens authored
    The Input formats - filter patch has landed. I still need to make update instructions for modules and update the hook docs.
    
    Here's an overview of the changes:
    1) Multiple Input formats: they are complete filter configurations (what filters to use, in what order and with which settings). Input formats are admin-definable, and usage of them is role-dependant. For example, you can set it up so that regular users can only use limited HTML, while admins can free HTML without any tag limitations.
    The input format can be chosen per content item (nodes, comments, blocks, ...) when you add/edit them. If only a single format is available, there is no choice, and nothing changes with before.
    
    The default install (and the upgrade) contains a basic set of formats which should satisfy the average user's needs.
    
    2) Filters have toggles
    Because now you might want to enable a filter only on some input formats, an explicit toggle is provided by the filter system. Modules do not need to worry about it and filters that still have their own on/off switch should get rid of it.
    
    3) Multiple filters per module
    This was necessary to accomodate the next change, and it's also a logical extension of the filter system.
    
    4) Embedded PHP is now a filter
    Thanks to the multiple input formats, I was able to move the 'embedded PHP' feature from block.module, page.module and book.module into a simple filter which executes PHP code. This filter is part of filter.module, and by default there is an input format 'PHP', restricted to the administrator only, which contains this filter.
    This change means that block.module now passes custom block contents through the filter system.
    As well as from reducing code duplication and avoiding two type selectors for page/book nodes, you can now combine PHP code with other filters.
    
    5) User-supplied PHP code now requires <?php ?> tags.
    This is required for teasers to work with PHP code. Because PHP evaluation is now just another step in the filter process, we can't do this. Also, because teasers are generated before filtering, this would result in errors when the teaser generation would cut off a piece of PHP code.
    
    Also, regular PHP syntax explicitly includes the <?php ?> tags for PHP files, so it makes sense to use the same convention for embedded PHP in Drupal.
    
    6) Filter caching was added.
    Benchmarking shows that even for a simple setup (basic html filtering + legacy URL rewriting), filtercache can offer speedups. Unlike the old filtercache, this uses the normal cache table.
    
    7) Filtertips were moved from help into a hook_filter_tips(). This was required to accomodate the fact that there are multiple filters per module, and that filter settings are format dependant. Shoehorning filter tips into _help was ugly and silly. The display of the filter tips is done through the input format selector, so filter_tips_short() no longer exists.
    
    8) A more intelligent linebreak convertor was added, which doesn't stop working if you use block-level tags and which adds <p> tags.
    660f9928
common.inc 54.8 KB