1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file flag_fields_test.install
|
5
|
* Contains install hooks.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_install().
|
10
|
*/
|
11
|
function flag_fields_test_install() {
|
12
|
// Add a number field to the flagging.
|
13
|
$field = array(
|
14
|
'field_name' => 'flag_fields_test_integer',
|
15
|
'type' => 'number_integer',
|
16
|
'cardinality' => '1',
|
17
|
'settings' => array(),
|
18
|
);
|
19
|
field_create_field($field);
|
20
|
|
21
|
$instance = array(
|
22
|
'field_name' => 'flag_fields_test_integer',
|
23
|
'entity_type' => 'flagging',
|
24
|
'bundle' => 'flag_fields_test_flag',
|
25
|
'label' => 'Test integer',
|
26
|
'widget' => array(
|
27
|
'weight' => 0,
|
28
|
'type' => 'number',
|
29
|
'module' => 'number',
|
30
|
'active' => 0,
|
31
|
'settings' => array(),
|
32
|
),
|
33
|
'settings' => array(
|
34
|
'min' => '',
|
35
|
'max' => '11',
|
36
|
'prefix' => '',
|
37
|
'suffix' => '',
|
38
|
'user_register_form' => FALSE,
|
39
|
),
|
40
|
'display' => array(
|
41
|
'default' => array(
|
42
|
'label' => 'above',
|
43
|
'type' => 'number_integer',
|
44
|
'settings' => array(
|
45
|
'thousand_separator' => ' ',
|
46
|
'decimal_separator' => '.',
|
47
|
'scale' => 0,
|
48
|
'prefix_suffix' => TRUE,
|
49
|
),
|
50
|
'module' => 'number',
|
51
|
'weight' => 1,
|
52
|
),
|
53
|
),
|
54
|
);
|
55
|
field_create_instance($instance);
|
56
|
}
|
57
|
|
58
|
/**
|
59
|
* Implements hook_uninstall().
|
60
|
*
|
61
|
* Not needed for testing, but useful for when developing tests as it allows
|
62
|
* use of Devel module's reinstall tool.
|
63
|
*/
|
64
|
function flag_fields_test_uninstall() {
|
65
|
// Delete our fields.
|
66
|
field_delete_field('flag_fields_test_integer');
|
67
|
}
|