You are here

function views_revisions_form_alter in Views Revisions 7

Same name and namespace in other branches
  1. 6 views_revisions.module \views_revisions_form_alter()

Implements hook_form_alter().

File

./views_revisions.module, line 53
A module to provide revisions of Views.

Code

function views_revisions_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_ui_edit_form' && $form_state['view']->vid != 'new') {
    $form['#prefix'] .= '<div>' . l('Views Revisions', 'admin/structure/views/revisions/' . $form_state['view']->name) . '</div>';
    $form['actions']['views_revisions_revision'] = array(
      '#type' => 'checkbox',
      '#title' => t('Create new revision'),
      '#default_value' => 1,
    );
    $form['actions']['views_revisions_log'] = array(
      '#type' => 'textarea',
      '#title' => t('Revision log message'),
      '#description' => t('Provide an explanation of the changes you are making. This will help other authors understand your motivations.'),
      '#rows' => 3,
    );
    array_unshift($form['actions']['save']['#submit'], 'views_revisions_form_submit');
  }
  else {
    if ($form_id == 'ctools_export_ui_delete_confirm_form') {
      $form['#submit'][] = 'views_revisions_delete';
    }
  }
}