Check_output() changes

Last modified: February 19, 2008 - 03:56

Because of the multiple input formats, a module which implements content has to take care of managing the format with each item. If your module uses the node system and passes content through check_output(), then you need to do two things:

  • Pass $node->format as the second parameter to check_output() whenever you use it.
  • Add a filter format selector to hook_form using a snippet like:
    <?php
    $output
    .= filter_form('format', $node->format);
    ?>

The node system will automatically save/load the format value for you.

If your module provides content outside of the node system, you can decide if you want to support multiple input formats or not. If you don't, the default format will always be used. However, if your module accepts input through the browser, it is strongly advised to support input formats!

To do this, you must:

  • Provide a selector for input formats on your forms, using filter_form().
  • Validate the chosen input format on submission, using filter_access().
  • Store the format ID with each content item (the format ID is a number).
  • Pass the format ID to check_output().

Check the API documentation for these functions for more information on how to use them.

 
 

Drupal is a registered trademark of Dries Buytaert.