Drupal PHP Cross Reference Content Management Systems

Source: /modules/simpletest/tests/filter_test.module - 62 lines - 1673 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /**
   4   * @file
   5   * Test module for Filter module hooks and functions not used in core.
   6   */
   7  
   8  /**
   9   * Implements hook_filter_format_insert().
  10   */
  11  function filter_test_filter_format_insert($format) {
  12    drupal_set_message('hook_filter_format_insert invoked.');
  13  }
  14  
  15  /**
  16   * Implements hook_filter_format_update().
  17   */
  18  function filter_test_filter_format_update($format) {
  19    drupal_set_message('hook_filter_format_update invoked.');
  20  }
  21  
  22  /**
  23   * Implements hook_filter_format_disable().
  24   */
  25  function filter_test_filter_format_disable($format) {
  26    drupal_set_message('hook_filter_format_disable invoked.');
  27  }
  28  
  29  /**
  30   * Implements hook_filter_info().
  31   */
  32  function filter_test_filter_info() {
  33    $filters['filter_test_uncacheable'] = array(
  34      'title' => 'Uncacheable filter',
  35      'description' => 'Does nothing, but makes a text format uncacheable.',
  36      'cache' => FALSE,
  37    );
  38    $filters['filter_test_replace'] = array(
  39      'title' => 'Testing filter',
  40      'description' => 'Replaces all content with filter and text format information.',
  41      'process callback' => 'filter_test_replace',
  42    );
  43    return $filters;
  44  }
  45  
  46  /**
  47   * Process handler for filter_test_replace filter.
  48   *
  49   * Replaces all text with filter and text format information.
  50   */
  51  function filter_test_replace($text, $filter, $format, $langcode, $cache, $cache_id) {
  52    $text = array();
  53    $text[] = 'Filter: ' . $filter->title . ' (' . $filter->name . ')';
  54    $text[] = 'Format: ' . $format->name . ' (' . $format->format . ')';
  55    $text[] = 'Language: ' . $langcode;
  56    $text[] = 'Cache: ' . ($cache ? 'Enabled' : 'Disabled');
  57    if ($cache_id) {
  58      $text[] = 'Cache ID: ' . $cache_id;
  59    }
  60    return implode("<br />\n", $text);
  61  }
  62  

title

Description

title

Description

title

Description

title

title

Body