You are here

function rh_taxonomy_bundle_form_submit in Rabbit Hole 7.2

Submit callback for the bundle form.

This will set the value of the variables, and update the name of the variables if the machine name of the vocabulary has changed.

File

modules/rh_taxonomy/rh_taxonomy.module, line 45
Main module file for Rabbit Hole taxonomy terms module.

Code

function rh_taxonomy_bundle_form_submit($form, $form_state) {
  $values = $form_state['values'];

  // Set the values of the variables. This will be set to the provided values,
  // if there are any provided values. They may be NULL if the user doesn't have
  // the administer rh_taxonomy permission. In this case, we'll set the
  // variables according to the stored values for the old machine name. We'll
  // use the old machine name in case it has changed.
  variable_set('rh_taxonomy_term_override_' . $values['machine_name'], isset($values['rh_taxonomy_term_override']) ? $values['rh_taxonomy_term_override'] : variable_get('rh_taxonomy_term_override_' . $values['old_machine_name']));
  variable_set('rh_taxonomy_term_action_' . $values['machine_name'], isset($values['rh_taxonomy_term_action']) ? $values['rh_taxonomy_term_action'] : variable_get('rh_taxonomy_term_action_' . $values['old_machine_name']));
  variable_set('rh_taxonomy_term_redirect_' . $values['machine_name'], isset($values['rh_taxonomy_term_redirect']) ? $values['rh_taxonomy_term_redirect'] : variable_get('rh_taxonomy_term_redirect_' . $values['old_machine_name']));
  variable_set('rh_taxonomy_term_redirect_response_' . $values['machine_name'], isset($values['rh_taxonomy_term_redirect_response']) ? $values['rh_taxonomy_term_redirect_response'] : variable_get('rh_taxonomy_term_redirect_response_' . $values['old_machine_name']));

  // Delete old variables if the machine name has changed.
  if ($values['machine_name'] != $values['old_machine_name']) {
    rabbit_hole_delete_variables('taxonomy_term', $values['old_machine_name']);
  }
}