function notifications_ui_settings_form in Notifications 7
Same name and namespace in other branches
- 5 notifications_ui/notifications_ui.module \notifications_ui_settings_form()
- 6.4 notifications_ui/notifications_ui.admin.inc \notifications_ui_settings_form()
- 6 notifications_ui/notifications_ui.pages.inc \notifications_ui_settings_form()
- 6.2 notifications_ui/notifications_ui.pages.inc \notifications_ui_settings_form()
- 6.3 notifications_ui/notifications_ui.pages.inc \notifications_ui_settings_form()
Site-wide settings form.
1 string reference to 'notifications_ui_settings_form'
- notifications_ui_menu in notifications_ui/
notifications_ui.module - Implementation of hook_menu()
File
- notifications_ui/
notifications_ui.admin.inc, line 10 - User pages for User Interface for subscriptions modules
Code
function notifications_ui_settings_form() {
// Display enabled subscription types
$subscription_types = array();
foreach (notifications_subscription_type_enabled() as $type) {
$subscription_types[] = array(
array(
'data' => notifications_subscription_type($type, 'title'),
'header' => TRUE,
),
notifications_subscription_type($type, 'description'),
);
}
$form['notifications_ui_types'] = array(
'#type' => 'item',
'#title' => t('Enabled subscription types'),
'#markup' => theme('table', array(
'rows' => $subscription_types,
)),
'#description' => t('Only options for enabled subscription types will be displayed. To enable or disable more subscription types go to <a href="@subscription-options">Subscription Options</a>.', array(
'@subscription-options' => url('admin/config/messaging/subscriptions'),
)),
);
// Widget options for each subscription type
$form['notifications_ui_options'] = array(
'#type' => 'vertical_tabs',
'#title' => t('Subscription widgets'),
);
// Collect all subscription options, some of them will be 'display options'
$subscription_options = notifications_info('display options');
foreach (notifications_subscription_type() as $type => $info) {
// We need to collect options that are display options for each type
$widgets = array(
'subscriptions_block',
);
if (!empty($info['display_options'])) {
$widgets = array_unique(array_merge($widgets, $info['display_options']));
}
$form[$type] = array(
'#type' => 'fieldset',
'#title' => check_plain($info['title']),
'#description' => check_plain($info['description']),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'notifications_ui_options',
'#tree' => TRUE,
);
$options = array();
foreach ($widgets as $index) {
if (isset($subscription_options[$index])) {
$form[$type][$index] = $subscription_options[$index] + array(
'#type' => 'checkbox',
'#default_value' => !empty($info[$index]),
);
}
}
}
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}