Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. /**
  2. * Implements hook_menu().
  3. */
  4. function node_revision_edit_menu() {
  5. $items['node/%node/revisions/%vid/modify'] = array(
  6. 'title' => 'Modify this revision',
  7. 'load arguments' => array(3),
  8. 'page callback' => 'drupal_get_form',
  9. 'page arguments' => array('node_revision_edit_form', 1, 3),
  10. 'access callback' => '_node_revision_edit_link_access',
  11. 'access arguments' => array('modify revisions'),
  12. 'file' => 'node_revision_edit.admin.inc',
  13. );
  14. return $items;
  15. }
  16.  
  17. function node_revision_edit_form($form, &$form_state, $node, $vid) {
  18.  
  19. // Prepare loading the node edit form
  20. form_load_include($form_state, 'inc', 'node', 'node.pages');
  21.  
  22. // Populate the form state.
  23. $form_state += form_state_defaults();
  24.  
  25. // Save the form id for the current content type.
  26. $nfid = $node->type . '_node_form';
  27.  
  28. // Rebuild the entire user edit form for our needs
  29. $form = drupal_retrieve_form($nfid, $form_state);
  30. drupal_prepare_form($nfid, $form, $form_state);
  31.  
  32. // Setup the already existing log in the field
  33. $form['revision_information']['log']['#default_value'] = node_revision_list($node)[$vid]->log;
  34.  
  35. // Set the "Modify current revision, no moderation" as the default revision operation
  36. $form['revision_information']['revision_operation']['#default_value'] = 0;
  37.  
  38. // Unset the options that we do not need
  39. // unset($form['options']);
  40.  
  41. // Create a new submit button since we do not want to invoke the standard callback functions
  42. unset($form['#submit']);
  43. $form['#submit'] = array('node_revision_edit_form_submit');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement