summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/common_test.module
blob: c1a8b7917499f0eb868743b9b9e4d741be57ed70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
// $Id$

/**
 * @file
 * Helper module for the Common tests.
 */

/**
 * Implement hook_theme().
 */
function common_test_theme() {
  return array(
    'common_test_foo' => array(
      'arguments' => array('foo' => 'foo', 'bar' => 'bar'),
    ),
  );
}

/**
 * Theme function for testing drupal_render() theming.
 */
function theme_common_test_foo($foo, $bar) {
  return $foo . $bar;
}

/**
 * Implementation of hook_library_alter().
 */
function common_test_library_alter(&$libraries, $module) {
  if ($module == 'system' && isset($libraries['farbtastic'])) {
    // Change the title of Farbtastic to "Farbtastic: Altered Library".
    $libraries['farbtastic']['title'] = 'Farbtastic: Altered Library';
    // Make Farbtastic depend on jQuery Form to test library dependencies.
    $libraries['farbtastic']['dependencies'][] = array('system', 'form');
  }
}

/**
 * Implementation of hook_library().
 *
 * Adds Farbtastic in a different version.
 */
function common_test_library() {
  $libraries['farbtastic'] = array(
    'title' => 'Custom Farbtastic Library',
    'website' => 'http://code.google.com/p/farbtastic/',
    'version' => '5.3',
    'js' => array(
      'misc/farbtastic/farbtastic.js' => array(),
    ),
    'css' => array(
      'misc/farbtastic/farbtastic.css' => array(),
    ),
  );
  return $libraries;
}