forked from easyting/ding_user_profile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathding_user_profile.admin.inc
More file actions
executable file
·51 lines (45 loc) · 1.24 KB
/
ding_user_profile.admin.inc
File metadata and controls
executable file
·51 lines (45 loc) · 1.24 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
<?php
/**
* @file
* Admin routine logic.
*/
/**
* Admin form structure.
*
* @param array $form
* The form, if any.
* @param $form_state
* Form input statue, if any.
*
* @return array
* The form itself.
*/
function ding_user_profile_admin_form($form, $form_state) {
$ding_provider = ding_provider_get_provider_module_name('user');
$instances = field_info_instances('profile2', 'provider_' . $ding_provider);
$form['user_profile_note'] = array(
'#type' => 'item',
'#markup' => t('The following fields will contain the description supplied below, however they might be hidden.'),
);
// These fields are standard in drupal.
// The use edit form has fields which cannot be edited.
$standard_fields = array(
'pass' => array(
'label' => 'pincode',
),
);
// Provider fields.
foreach ($standard_fields + $instances as $key => $instance) {
if (isset($instances[$key]) && $instances[$key]['widget']['type'] == 'hidden') {
continue;
}
$field = 'user_profile_' . $key;
$form[$field] = array(
'#type' => 'textarea',
'#rows' => 2,
'#title' => ucfirst($instance['label']),
'#default_value' => t(variable_get($field, '')),
);
}
return system_settings_form($form);
}