-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctools_context_example.module
More file actions
63 lines (56 loc) · 2.15 KB
/
ctools_context_example.module
File metadata and controls
63 lines (56 loc) · 2.15 KB
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
58
59
60
61
62
63
<?php
function ctools_context_example_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'ctools' || $owner == 'page_manager' || $owner == 'panels') {
return "plugins/$plugin_type";
}
}
function ctools_context_example_theme() {
$base = array(
'path' => drupal_get_path('module', 'ctools_context_example') . '/theme',
);
return array(
'match_stats' => $base + array(
'template' => 'match-stats',
'variables' => array('stats' => NULL),
),
'towers_remaining' => $base + array(
'template' => 'towers-remaining',
'variables' => array('stats' => NULL),
),
);
}
function ctools_context_example_menu() {
$items['admin/config/ctools_context_example'] = array(
'title' => 'Ctools Context Example',
'description' => 'Settings to the Ctools context example',
'position' => 'right',
'weight' => 20,
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('access administration pages'),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);
$items['admin/config/ctools_context_example/settings'] = array(
'title' => 'Module settings',
'description' => 'Configure the Ctools context example here.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ctools_context_example_admin'),
'access arguments' => array('access administration pages'),
);
return $items;
}
function ctools_context_example_admin() {
$form['ctools_context_example_api_key'] = array(
'#type' => 'textfield',
'#title' => t('Steam API key'),
'#default_value' => variable_get('ctools_context_example_api_key', ''),
'#description' => t("Enter your API key here to disable the use of the module's sample data. You may obtain one here: http://steamcommunity.com/dev/apikey"),
);
return system_settings_form($form);
}
function ctools_context_example_admin_validate($form, &$form_state) {
$key = $form_state['values']['ctools_context_example_api_key'];
if (!empty($key) && strlen($key) != 32 ) {
form_set_error('ctools_context_example_api_key', t('Your key does not contain the correct amount of characters.'));
}
}