Drupal Association members fund grants that make connections all over the world.
Here's an outline of how/when the htmLawed filtering step works in version 2 of the module.
- 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 hierarchically 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 hierarchical 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.