function notifications_ui_form_alter in Notifications 5
Same name and namespace in other branches
- 6.4 notifications_ui/notifications_ui.module \notifications_ui_form_alter()
- 6 notifications_ui/notifications_ui.module \notifications_ui_form_alter()
- 6.2 notifications_ui/notifications_ui.module \notifications_ui_form_alter()
- 6.3 notifications_ui/notifications_ui.module \notifications_ui_form_alter()
- 7 notifications_ui/notifications_ui.module \notifications_ui_form_alter()
Implementation of hook_form_alter()
File
- notifications_ui/
notifications_ui.module, line 90 - User Interface for subscriptions modules
Code
function notifications_ui_form_alter($form_id, &$form) {
global $user;
// Content type settings
if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
// Just in case we want to add more settings here
$form['workflow']['notifications_node_ui'] = array(
'#type' => 'checkboxes',
'#title' => t('Subscriptions UI'),
'#default_value' => notifications_ui_type_options($form['#node_type']->type),
'#options' => _notifications_ui_type_options(),
'#description' => t('Enable different display options for subscriptions to this content type'),
);
}
elseif (isset($form['type']) && $form['type']['#value'] . '_node_form' == $form_id && notifications_ui_type_options($form['#node']->type, 'form')) {
// Add node forms.
$node = $form['#node'];
$form[] = notifications_ui_node_form($node);
}
elseif ($form_id == 'comment_form') {
// Add to comment forms.
$node = node_load($form['nid']['#value']);
if ($user->uid && notifications_ui_type_options($node->type, 'comment')) {
$form[] = notifications_ui_node_form($node);
}
}
}