function notifications_multiple_delete_confirm in Notifications 6.3
Same name and namespace in other branches
- 6.4 notifications.manage.inc \notifications_multiple_delete_confirm()
- 6 notifications.manage.inc \notifications_multiple_delete_confirm()
- 6.2 notifications.manage.inc \notifications_multiple_delete_confirm()
- 7 notifications.pages.inc \notifications_multiple_delete_confirm()
Form for multiple delete. When account passed check that all subscriptions belong to the user account
2 calls to notifications_multiple_delete_confirm()
- notifications_manage_admin_subscriptions in ./
notifications.manage.inc - Menu callback: subscriptions administration.
- notifications_manage_user_subscriptions in ./
notifications.manage.inc - Menu callback: user subscriptions management
File
- ./
notifications.manage.inc, line 332 - Common functions for bulk management of subscriptions
Code
function notifications_multiple_delete_confirm(&$form_state, $items, $destination = NULL) {
$destination = $destination ? $destination : $_GET['q'];
if (notifications_manage_subscriptions_access(array_keys($items))) {
$form['items'] = array(
'#prefix' => '<ul>',
'#suffix' => '</ul>',
'#tree' => TRUE,
);
// array_filter returns only elements with TRUE values
foreach ($items as $id => $value) {
// Load the subscription to display a friendly name
$subscription = notifications_load_subscription($id);
$title = notifications_format_subscription($subscription, 'long');
$form['items'][$id] = array(
'#type' => 'hidden',
'#value' => $id,
'#prefix' => '<li>',
'#suffix' => $title . "</li>\n",
);
}
$form['operation'] = array(
'#type' => 'hidden',
'#value' => 'delete',
);
$form['#submit'][] = 'notifications_multiple_delete_confirm_submit';
$form['#validate'][] = 'notifications_multiple_delete_confirm_validate';
$form['#redirect'] = $destination;
return confirm_form($form, t('Are you sure you want to delete these items?'), $destination, t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
}
else {
drupal_set_message(t('Validation error. You don\'t have permission to delete some of these subscriptions'), 'error');
drupal_access_denied();
}
}