1 filter_example.module filter_example_filter_info()

Implements hook_filter_info().

Here we define the different filters provided by the module. For this example, time_filter is a very static and simple replacement, but it requires some preparation of the string because of the special html tags < and >. The foo_filter is more complex, including its own settings and inline tips.

Related topics

File

modules/examples/filter_example/filter_example.module, line 72
Module file for filter_example.

Code

function filter_example_filter_info() {
  $filters['filter_foo'] = array(
    'title' => t('Foo Filter (example)'),
    'description' => t('Every instance of "foo" in the input text will be replaced with a preconfigured replacement.'),
    'process callback' => '_filter_example_filter_foo_process',
    'default settings' => array(
      'filter_example_foo' => 'bar',
    ),
    'settings callback' => '_filter_example_filter_foo_settings',
    'tips callback' => '_filter_example_filter_foo_tips',
  );
  $filters['filter_time'] = array(
    'title' => t('Time Tag (example)'),
    'description' => t("Every instance of the special &lt;time /&gt; tag will be replaced with the current date and time in the user's specified time zone."),
    'prepare callback' => '_filter_example_filter_time_prepare',
    'process callback' => '_filter_example_filter_time_process',
    'tips callback' => '_filter_example_filter_time_tips',
  );
  return $filters;
}