I'm using revisions to keep a public archive of changes in my nodes. Is it possible for me to edit an old revision of a node (both the message and the fields) directly, and not change the current revision? Basically, what I'm trying to do is what the User Revision Edit module does, but for nodes.
So far, in my custom module, I have something like this (notice that I'm also using the Revisioning module):
/** * Implements hook_menu(). */ function node_revision_edit_menu() { $items['node/%node/revisions/%vid/modify'] = array( 'title' => 'Modify this revision', 'load arguments' => array(3), 'page callback' => 'drupal_get_form', 'page arguments' => array('node_revision_edit_form', 1, 3), 'access callback' => '_node_revision_edit_link_access', 'access arguments' => array('modify revisions'), 'file' => 'node_revision_edit.admin.inc', ); return $items; } and the essence of the logic that I'm trying to apply:
function node_revision_edit_form($form, &$form_state, $node, $vid) { // Prepare loading the node edit form form_load_include($form_state, 'inc', 'node', 'node.pages'); // Populate the form state. $form_state += form_state_defaults(); // Save the form id for the current content type. $nfid = $node->type . '_node_form'; // Rebuild the entire user edit form for our needs $form = drupal_retrieve_form($nfid, $form_state); drupal_prepare_form($nfid, $form, $form_state); // Setup the already existing log in the field $form['revision_information']['log']['#default_value'] = node_revision_list($node)[$vid]->log; // Set the "Modify current revision, no moderation" as the default revision operation $form['revision_information']['revision_operation']['#default_value'] = 0; // Unset the options that we do not need // unset($form['options']); // Create a new submit button since we do not want to invoke the standard callback functions unset($form['#submit']); $form['#submit'] = array('node_revision_edit_form_submit'); My problem is that I have no idea as to where to go from here. I obviously can't use node_save since it automatically handles revisions. Any ideas on what my next step should be? Is there a function that I'm missing and could be useful for my problem? Or will I have to go for direct database edits?
Any feedback is greatly appreciated.