1 filter.api.php callback_filter_process($text, $filter, $format, $langcode, $cache, $cache_id)

Provide text filtered to conform to the supplied format.

Callback for hook_filter_info().

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


$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.:

Related topics


core/modules/filter/filter.api.php, line 304
Hooks provided by the Filter module.


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

  return $text;