You are here

function revisioning_form_node_type_form_alter in Revisioning 7

Same name and namespace in other branches
  1. 8 revisioning.pages.inc \revisioning_form_node_type_form_alter()
  2. 6.4 revisioning.pages.inc \revisioning_form_node_type_form_alter()
  3. 6.3 revisioning.pages.inc \revisioning_form_node_type_form_alter()

Implements hook_form_FORM_ID_form_alter().

On the content type edit form, add the "New revision in draft, pending moderation" tick-box and a couple of radio-boxes to select the new revision and auto-publish policies.

File

./revisioning.pages.inc, line 117
Rendering and altering of pages and forms used by Revisioning.

Code

function revisioning_form_node_type_form_alter(&$form, &$form_state) {
  $form['workflow']['#collapsed'] = FALSE;
  $form['workflow']['node_options']['#options']['revision_moderation'] = t('New revision in draft, pending moderation (requires "Create new revision")');
  $form['workflow']['revisioning'] = array(
    '#type' => 'fieldset',
    '#title' => t('New revision in draft'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $content_type = $form['#node_type']->type;
  $form['workflow']['revisioning']['new_revisions'] = array(
    '#title' => t('Create new revision:'),
    '#type' => 'radios',
    '#options' => array(
      REVISIONING_NEW_REVISION_WHEN_NOT_PENDING => t('Only when saving %type content that is not already in draft/pending moderation', array(
        '%type' => $content_type,
      )),
      REVISIONING_NEW_REVISION_EVERY_SAVE => t('Every time %type content is updated, even when saving content in draft/pending moderation', array(
        '%type' => $content_type,
      )),
    ),
    '#default_value' => (int) variable_get('new_revisions_' . $content_type, REVISIONING_NEW_REVISION_WHEN_NOT_PENDING),
    '#description' => t('Use less disk space and avoid cluttering your revisions list. With the first option ticked, modifications are saved to the same copy (i.e. no additional revisions are created) until the content is published.'),
  );
  $form['workflow']['revisioning']['revisioning_auto_publish'] = array(
    '#title' => t('Auto-publish drafts of type %type (for moderators)', array(
      '%type' => $content_type,
    )),
    '#type' => 'checkbox',
    '#default_value' => (int) variable_get('revisioning_auto_publish_' . $content_type, FALSE),
    '#description' => t('If this box is ticked and the user has one of the "Publish content revisions" permissions, then any draft of type %type is published immediately upon saving, without further review or the option to schedule a publication date.', array(
      '%type' => $content_type,
    )),
  );
}