0

I am working on creating a filter module starting with the hook_filter_info file. This hook requires a callback method via a 'process callback' filter setting.

Now the problem is: how do I know what parameters that this callback method requires? I have taken a look at filter.api.php and see this:

function hook_filter_FILTER_process($text, $filter, $format, $langcode, $cache, $cache_id)      {
$text = preg_replace('|\[codefilter_code\](.+?)\[/codefilter_code\]|se', "<pre>$1</pre>", $text);
return $text;
}

but I have seen this callback filter called like this :

mymodule_process($text, $filter, $format);

mymodule_process($text, $filter, $format, $language);

mymodule_process($text, $filter, $format, $language, $cache);

...

Now how do I know the amount of arguments that this method requires? Or does it require any argument at all?

0

I've never had to use this specific hook before, but I have found a breakdown of the callback in the Drupal docs:

https://api.drupal.org/api/drupal/modules!filter!filter.api.php/function/callback_filter_process/7

Pretty sure everything you're after will be described in the documentation. You can view all the other Filter API functions within the documentation here:

https://api.drupal.org/api/drupal/modules!filter!filter.api.php/7

  • i have read the documentation and i see the number of parameters but if you look at my question, i am asking about the function signature. We can pretty much call it with any number of parameters and we are not getting any errors. – winteck Feb 16 '14 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.