To create a filter, you can do these steps:
- Go to Custom Filters (/admin/settings/customfilter) (6.x & 7.x)
- Click Add Filter tab
Now there should be a form asking some properties. Give this new filter:
- Name, as an identifier for this filter
- Description, some sort of description to describe what this filter is about and what this filter does. This information is used only in the Custom Filter administration page.
- Tips (short), short tips to be shown in the node creation form, below body field.
- Tips (full), longer tips to be shown in Compose Tips. That is the page when you click more information about formatting options.
- Cache to determine the node should be cached. When this option is on, filtering will be cached. If you need a filter that must be processed everytime the node loads (e.g. filter that shows current date/time, or filter that generates random numbers), you should turn this option off.
The just created filter won't do anything. Before our new filter could do any filtering, first we must add one or some replacement rules. To add replacement rules, you can do these steps:
- Go to Custom Filter
- Click on the name of our new filter (click on the name, not on edit. Edit is for editing properties of the filter).
- Click Add Rule.
Now there should be a form. Here you can specify:
- Name, name for this replacement rule.
- Pattern, pattern to be found.
- PHP Code, an option to tell Drupal about the replacement text.
- Replacement Text.