0

I just installed the Revisioning module, but all my existing nodes are set to: "Modify current revision, no moderation", but I would like it to be set as create new revision by default. I don't want my users to manually click this when they are editing a node.

How do I make it by default to create a new revision for existing nodes?

Creating new nodes is not an issue as its already set by default to create a new revision.

enter image description here

1

You can alter the node edit form following the Revisioning's implementation.

/**
 * Implements hook_form_alter().
 */
function myModule_form_alter(&$form, &$form_state, $form_id) {
  if (!empty($form['#node_edit_form'])) {
    if (isset($form['revision_information']['revision_operation'])) {
      $form['revision_information']['revision_operation']['#default_value'] = REVISIONING_NEW_REVISION_NO_MODERATION;
    }
  }
}

/**
 * Implements HOOK_module_implements_alter().
 *
 * Ensure our hook runs after revisioning_form_alter().
 */
function myModule_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'form_alter') {
    $group = $implementations['myModule'];
    unset($implementations['myModule']);
    $implementations['myModule'] = $group;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.