All pastes #584452 Raw Edit

pwolanin

public php v1 · immutable
·published 2007-06-22 19:34 UTC
rendered paste body
// does not work, in book_nodeapi:    case 'delete':      if (isset($node->book)) {        drupal_delete_add_callback( array('book_delete_post' => array($node->book),));        drupal_delete_add_query('DELETE FROM {book} WHERE mlid = %d', $node->book['mlid']);      $form['node_'. $node->nid]['book_warning'] = array(        '#value' => '<p>'. t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.' .'</p>', array('%title' => $node->title)),        '#weight' => -10,      );       drupal_delete_add_form_elements($form);      }//works:function book_delete_pre($type, $id, $package_info) {  $form = array();  if ($type == 'node' && is_numeric($id)) {    $node = node_load($id);    if (isset($node->book) && $node->book['has_children']) {      $form['node_'. $node->nid]['book_warning'] = array(        '#value' => '<p>'. t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.' .'</p>', array('%title' => $node->title)),        '#weight' => -10,      );    }  }  return $form;}