function book_helper_display_delete_book_page_warning in Book helper 6
Same name and namespace in other branches
- 7 book_helper.module \book_helper_display_delete_book_page_warning()
Display a warning warning when deleting a book page that has child pages.
1 call to book_helper_display_delete_book_page_warning()
- book_helper_help in ./
book_helper.module - Implementation of hook_help().
File
- ./
book_helper.module, line 245 - Improves Drupal's core book module's functionality.
Code
function book_helper_display_delete_book_page_warning($nid) {
$node = node_load($nid);
if (isset($node->book) && $node->book['bid'] != $node->nid) {
$book_node = node_load($node->book['bid']);
$result = db_query('SELECT mlid, link_title AS title, link_path AS href FROM {menu_links} WHERE plid=%d ORDER BY weight', $node->book['mlid']);
$links = array();
while ($record = db_fetch_array($result)) {
$links[$record['mlid']] = $record;
}
if (empty($links)) {
return;
}
$t_args = array(
'!book' => l($book_node->title, 'node' . $book_node->nid),
);
$output = t('The below book pages are not going to be deleted, they will be moved to the root of the !book book.', $t_args) . '<br />' . t('It is recommended that you delete or move these pages before proceeding.') . theme('links', $links, array());
drupal_set_message($output, 'warning');
}
}