function nodehierarchy_alter_node_delete_confirm_form in Node Hierarchy 7.4
Add Node Hierarchy delete options to the node delete confirm form.
1 call to nodehierarchy_alter_node_delete_confirm_form()
- nodehierarchy_form_alter in ./
nodehierarchy.module - Implementation of hooks_form_alter().
File
- ./
nodehierarchy.admin.inc, line 136 - Admin functions for Node Hierarchy
Code
function nodehierarchy_alter_node_delete_confirm_form(&$form, &$form_state, $form_id) {
// TODO: Fix the descendant count code to deal with multiparent situations.
if ($count = nodehierarchy_get_node_children_count($form['nid']['#value'])) {
$items = array();
foreach (nodehierarchy_get_node_children($form['nid']['#value'], 10) as $child) {
$items[] = check_plain($child->title);
}
if ($count > 10) {
$items[] = l(t('See all !count children', array(
'!count' => $count,
)), 'node/' . $form['nid']['#value'] . '/children');
}
$list = theme('item_list', array(
'items' => $items,
));
$description = format_plural($count, 'This node has @count child. Check this box to delete it and all of its descendants as well.', 'This node has @count children. Check this box to delete them and all of their descendants as well.');
$description .= t('<p>These children and their decendants will be deleted:!list<p>', array(
'!list' => $list,
));
$form['nodehierarchy_delete_children'] = array(
'#type' => 'checkbox',
'#title' => t('Delete descendants'),
'#description' => $description,
);
array_unshift($form['#submit'], 'nodehierarchy_node_delete_form_submit');
$form['actions']['#weight'] = 1;
}
}