Projet

Général

Profil

Paste
Télécharger (1,68 ko) Statistiques
| Branche: | Révision:

root / drupal7 / modules / simpletest / tests / filter_test.module @ db2d93dd

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
 * Implements callback_filter_process().
48
 *
49
 * Process handler for filter_test_replace filter.
50
 *
51
 * Replaces all text with filter and text format information.
52
 */
53
function filter_test_replace($text, $filter, $format, $langcode, $cache, $cache_id) {
54
  $text = array();
55
  $text[] = 'Filter: ' . $filter->title . ' (' . $filter->name . ')';
56
  $text[] = 'Format: ' . $format->name . ' (' . $format->format . ')';
57
  $text[] = 'Language: ' . $langcode;
58
  $text[] = 'Cache: ' . ($cache ? 'Enabled' : 'Disabled');
59
  if ($cache_id) {
60
    $text[] = 'Cache ID: ' . $cache_id;
61
  }
62
  return implode("<br />\n", $text);
63
}
64