I created a .module and .info and placed the following code:

<?php

function test_filter($op, $delta = 0, $format = -1, $text = '') {
  if ($op == 'list') {
    return array(0 => t('test filter'));
  }
  
  switch ($op) {
    case 'description':
      return t('Test filter.');
    
    case 'prepare':
      return $text.' why is this not working?';
    
    case 'process':
      return $text.' why is this not working?';
  }
}

as described here: http://api.drupal.org/api/HEAD/function/filter_example_filter

However, once I enable the module nothing happens. Do I need to do something differently?

Thank you in advance.

Comments

gollyg’s picture

I have never developed a filter, but have you enabled the filter for an input format and then applied that input format to some content? Also, have you disabled the cache? Could be little things that are not working.

If they do work I would try to confirm that the function is being called - maybe a drupal_set_message('function called') inside the function but outside the switch and if statement.

At lease then you know whether or not the function is getting invoked correctly.

Keith Adler’s picture

It was under "Home › Administer › Site configuration > Input formats".