You are here

function block_revisions_form_alter in Block Revisions 6

Same name and namespace in other branches
  1. 7 block_revisions.module \block_revisions_form_alter()

Implementation of hook_form_alter().

Alter the form for custom block edits and additions, injecting the revisions sub-form and adding the necessary submit handlers.

File

./block_revisions.module, line 103

Code

function block_revisions_form_alter(&$form, $form_state, $form_id) {
  $module = arg(4);

  // Alter the form if the user is adding a new custom block, or when he/she
  // is editing an existing custom block.
  if ($form_id === 'block_add_block_form' || $form_id === 'block_admin_configure' && isset($module) && $module === 'block') {
    $form['block_settings'] += _block_revisions_form();

    // Add a submit handler to update the boxes and boxes_revision tables
    // after the user saved the block.
    array_push($form['#submit'], '_block_revisions_form_submit');
  }
}