Skip navigation
Help

hook_filter_FILTER_process

7 filter.api.php hook_filter_FILTER_process($text, $filter, $format, $langcode, $cache, $cache_id)

Process callback for hook_filter_info().

Note: This is not really a hook. The function name is manually specified via 'process callback' in hook_filter_info(), with this recommended callback name pattern. It is called from check_markup().

See hook_filter_info() for a description of the filtering process. This step is where the filter actually transforms the text.

Parameters

$text: The text string to be filtered.

$filter: The filter object containing settings for the given format.

$format: The text format object assigned to the text to be filtered.

$langcode: The language code of the text to be filtered.

$cache: A Boolean indicating whether the filtered text is going to be cached in {cache_filter}.

$cache_id: The ID of the filtered text in {cache_filter}, if $cache is TRUE.

Return value

The filtered text.

File

drupal/modules/filter/filter.api.php, line 236
Hooks provided by the Filter module.

Code

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;
}