You are here

function spoiler_filter in Spoiler 6

Same name and namespace in other branches
  1. 5 spoiler.module \spoiler_filter()

Implementation of hook_filter().

File

./spoiler.module, line 40
Spoiler module: This module allows users to hide potential "spoiler" content by inserting them between [spoiler][/spoiler] tags. These tags will be converted to HTML by this filter. If JavaScript is available, then a button will be presented…

Code

function spoiler_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(
        0 => t('Spoiler filter'),
      );
    case 'description':
      return t('Converts [spoiler][/spoiler] tags to markup which hides the content within. When Javascript is available, a button is made available which can be clicked to view the hidden content. Alternatively, when Javascript is disabled, the filter sets the foreground and background colours to the same value, effectively rendering the content within invisible until highlighted.');
    case 'process':
      return _spoiler_filter_process($text);
    default:
      return $text;
  }
}