You are here

function revisioning_form_node_type_form_alter in Revisioning 6.3

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. 7 revisioning.pages.inc \revisioning_form_node_type_form_alter()

Implementation of hook_form_FORM_ID_form_alter().

On 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 60
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")');
  $content_type = $form['#node_type']->type;
  $form['workflow']['revisioning'] = array(
    '#type' => 'fieldset',
    '#title' => t('New revision in draft'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['workflow']['revisioning']['new_revisions'] = array(
    '#title' => t('Create new revision'),
    '#type' => 'radios',
    '#options' => array(
      NEW_REVISION_WHEN_NOT_PENDING => t('Only when saving %type content that is not already in draft/pending moderation', array(
        '%type' => $content_type,
      )),
      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, 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 @this type %type (for moderators)', array(
      '@this' => empty($content_type) ? t('this') : '',
      '%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 logged-in user has one of the "publish revisions" permissions, then any draft of @this type %type is published immediately upon saving, without further review.', array(
      '@this' => empty($content_type) ? t('this') : '',
      '%type' => $content_type,
    )),
  );
}