Notes

Installation

  • Read the htmLawed documentation and note the filter's limitations.
  • Check for conflicts with any third-party filter modules in use. Re-arranging filters used in a format can resolve conflicts. So can allowing htmLawed let through HTML tags/attributes introduced by other filters.

Updates

  • Look for latest recommended versions on the htmLawed module project site.
  • You'd usually have to just replace the old module files with the new ones. Remember to run the update script from the main modules admin page of your Drupal site.
  • You can also replace files inside modules/htmLawed/htmLawed/ with the latest versions of the htmLawed filter script and documentation obtained from the htmLawed website.

Configuration

  • Content-type-specific settings for Other are not possible. The settings set for Default apply to all content-types.
  • Deleting a content-type will delete the associated htmLawed settings.
  • Deleting an input format will not automatically delete the associated htmLawed settings. You have to run cron to delete the not-needed htmLawed settings: Administer » Reports/Logs » Status report » run cron manually.
  • Disabling htmLawed for an input format will not delete the associated settings.
  • Uninstalling the htmLawed module through Administer » Site building » Modules » Uninstall will delete all htmLawed settings.
  • Disabling the module will not delete any htmLawed setting.
  • The save functionality is turned off by default for all input formats and content-types.
  • Teaser content is available for filtering at two points -- first as per Body and then as per Teaser. So, if htmLawed is turned off for Teaser, it does not mean that teasers are not filtered. As long as htmLawed is enabled for Body, teasers will be filtered as per the Body settings.
  • When a new content-type is created, the htmLawed-settings to be used with it must be set; otherwise, the default settings will be used.

The htmLawed filtering step

alpha2zee - May 17, 2008 - 07:36

Here's an outline of how/when the htmLawed filtering step works.

  • For displaying the main content (body; not teasers/RSS items), Drupal gets the node's content from the database, checks the associated 'input format', and runs the content sequentially through all the filters that are active for that format in the order set for the format.
  • If htmLawed filter is called, the module gets the node-type (content-type) of the content and retrieves the settings for the filter. The settings are thus hierarchially input format-, content-type- and body-specific (Drupal's in-built filters are just input format-specific). However, filtering will actually be done only if the Use option for that content-type for Body is enabled in the module.
  • When a user submits content, Drupal auto-generates the teaser from the body and stores it separately from body. Drupal does not modify the user submission, but third-party modules might. E.g., with save enabled, htmLawed will individually filter the body and the teaser using the input format-, content-type- and body-specific settings (using the same settings for both body and teaser) before Drupal stores the two items.
  • For displaying teasers (and RSS items), Drupal works the same way as for body, running all filters specified by the input format associated with the node. If htmLawed is called, it will actually filter only if the Use option for Teaser is enabled for the content-type. And, unlike most filters, it will use the Teaser (and not body)-specific settings. Also note that there is no save option for teasers in the htmLawed module as teasers are auto-generated from body.
  • Comments are considered to have the same node-type as the node they are for. Any htmLawed filtering of comments (i.e., when Use or save is enabled for comments for that content-type in the htmLawed module) will use the comment (and not body)-specific settings. Like the case with teasers, this too is unlike most filters.

It is important to note that htmLawed will filter only when the Use or Enable for save options of the htmLawed module are checked for the content-type (node-type) for, as appropriate, Body, Comment or Teaser.

Some points about the default settings used by the module:

  • The module tries to retrieve the hierarchial input format-, content-type- and Body/Comment/Teaser-specific settings (the Config. and Spec. values) for htmLawed to use. These settings are stored in arrays in Drupal's 'variables' table.
  • When filtering is being done before data storage ('Enable for save'), the retrieved and interpreted Config. needs to look like a PHP array. If not (e.g., when the htmLawed settings form was mis-filled), no filtering is performed.
  • However, when filtering is being done on retrieved data for display ('Use'), and the retrieved and interpreted Config. does not look like an array, htmLawed uses the default value of array('safe'=>1, 'elements'=>'a, em...', ...);
  • The default value is the same for Body, Comment and Teaser for all content-types for all input formats (except that Teaser also covers the br and p tags).
  • The default Config. value is also pre-filled in the form-fields in the module's settings form.
  • Emptying a Config. form-field does not mean that the default value will be used.
  • The default values are certainly used when the module cannot find/read the specific settings stored in the database.
  • The Default sub-form allows using your own default values.
  • An option for Other is available under Default. The values set the configuration for the filtering of input text that is not content-type-based. E.g., the text submitted for a header field on a page created by the Views module.

Odd Drupal 5 behavior?

alpha2zee - May 11, 2008 - 23:53

If you edit text such that the changes do not affect the teaser portion (e.g., when the edited part is towards the end of a long body), then Drupal 5 does not update the teaser preview, the teaser on the front page, etc. And because drupal uses cached content if possible, any changes to filter settings also do not affect those items. Please correct me if I am wrong.

 
 

Drupal is a registered trademark of Dries Buytaert.