You are here

function _node_revision_delete_form_node_type_submit in Node Revision Delete 7.3

Custom submit handler to save the configuration variables.

Parameters

array $form: The form element.

array $form_state: The form state.

1 string reference to '_node_revision_delete_form_node_type_submit'
node_revision_delete_form_node_type_form_alter in ./node_revision_delete.module
Implements hook_form_BASE_FORM_ID_alter().

File

./node_revision_delete.module, line 189

Code

function _node_revision_delete_form_node_type_submit(array &$form, array &$form_state) {

  // Getting the form values.
  $track = $form_state['values']['node_revision_delete_track'];

  // Getting the content type machine name.
  $content_type = $form['type']['#value'];

  // If we will track the content type.
  if ($track) {

    // Getting the form values.
    $minimum_revisions_to_keep = $form_state['values']['minimum_revisions_to_keep'];
    $minimum_age_to_delete = $form_state['values']['minimum_age_to_delete'];
    $when_to_delete = $form_state['values']['when_to_delete'];

    // Saving the values in the config.
    _node_revision_delete_save_content_type_config($content_type, $minimum_revisions_to_keep, $minimum_age_to_delete, $when_to_delete);
  }
  elseif (!isset($form_state['complete form']['#node_type']->is_new) || !$form_state['complete form']['#node_type']->is_new) {

    // Deleting the value from the config.
    _node_revision_delete_delete_content_type_config($content_type);
  }

  // Cleaning the values to avoid that Drupal create variables for them.
  unset($form_state['values']['node_revision_delete_track']);
  unset($form_state['values']['minimum_revisions_to_keep']);
  unset($form_state['values']['minimum_age_to_delete']);
  unset($form_state['values']['when_to_delete']);
}