function activity_admin_settings in Activity 5.2
Same name and namespace in other branches
- 5.4 activity.module \activity_admin_settings()
- 5 activity.module \activity_admin_settings()
- 5.3 activity.module \activity_admin_settings()
- 6 activity.module \activity_admin_settings()
Admin section
1 string reference to 'activity_admin_settings'
- activity_menu in ./
activity.module - Implementation of hook_menu().
File
- ./
activity.module, line 67 - Activity module: Allow users to see their friends' activity on the site.
Code
function activity_admin_settings() {
foreach (module_implements('activity_info') as $module) {
$modules[] = module_invoke($module, 'activity_info');
}
if (!empty($modules[0])) {
foreach ($modules as $module) {
if (!empty($module)) {
switch (arg(3)) {
case 'tokens':
if (variable_get('activity_' . $module['name'] . '_module', 0) == 1) {
$tokens = array();
foreach ($module['tokens'] as $token => $desc) {
$tokens[] = '[' . $token . ']: ' . $desc;
}
$form['activity_' . $module['name'] . '_token'] = array(
'#type' => 'fieldset',
'#title' => $module['name'],
'#collapsible' => true,
'#collapsed' => true,
'#description' => t('Available tokens') . theme('item_list', $tokens),
);
foreach ($module['ops'] as $op) {
foreach ($module['types'] as $type => $name) {
if (variable_get('activity_' . $module['name'] . '_' . $type, 0) == 1) {
$form['activity_' . $module['name'] . '_token']['activity_' . $module['name'] . '_' . $op . '_' . $type . '_token'] = array(
'#type' => 'textfield',
'#title' => t($op . ' ' . $name),
'#default_value' => variable_get('activity_' . $module['name'] . '_' . $op . '_' . $type . '_token', ''),
);
}
}
if (empty($module['types'])) {
$form['activity_' . $module['name'] . '_token']['activity_' . $module['name'] . '_' . $op . '_token'] = array(
'#type' => 'textfield',
'#title' => t($op),
'#default_value' => variable_get('activity_' . $module['name'] . '_' . $op . '_token', ''),
);
}
}
}
break;
default:
$form['activity_message_limit'] = array(
'#type' => 'textfield',
'#title' => 'Message Limit',
'#description' => t('Set a limit for how many messages display on the activity display.'),
'#default_value' => variable_get('activity_message_limit', 20),
);
$form['activity_' . $module['name']] = array(
'#type' => 'fieldset',
'#title' => $module['name'],
'#collapsible' => true,
'#collapsed' => false,
);
$form['activity_' . $module['name']]['activity_' . $module['name'] . '_module'] = array(
'#type' => 'checkbox',
'#title' => $module['name'],
'#default_value' => variable_get('activity_' . $module['name'] . '_module', 0),
'#description' => t('Check to enable activity tracking for this module.'),
);
if (!empty($module['types'])) {
$form['activity_' . $module['name']]['activity_' . $module['name'] . '_type'] = array(
'#type' => 'fieldset',
'#title' => t('activity types'),
'#collapsible' => true,
'#collapsed' => true,
'#description' => t('Check to enable activity tracking for this type of activity.'),
);
foreach ($module['types'] as $type => $name) {
$form['activity_' . $module['name']]['activity_' . $module['name'] . '_type']['activity_' . $module['name'] . '_' . $type] = array(
'#type' => 'checkbox',
'#title' => $name,
'#default_value' => variable_get('activity_' . $module['name'] . '_' . $type, 0),
);
}
}
break;
}
}
}
}
else {
$form = array();
drupal_set_message('No supported modules enabled. Check the ' . l('Activity section', 'admin/build/modules') . ' for supported modules.');
}
return system_settings_form($form);
}