You are here

function taxonomy_access_disable_vocab_confirm_submit in Taxonomy Access Control 7

Form submission handler for taxonomy_access_disable_vocab_confirm().

@todo Set a message on invalid $rid or $vid?

Parameters

int $rid: The role ID to disable.

File

./taxonomy_access.admin.inc, line 709
Administrative interface for taxonomy access control.

Code

function taxonomy_access_disable_vocab_confirm_submit($form, &$form_state) {
  $roles = _taxonomy_access_user_roles();
  $rid = intval($form_state['values']['rid']);
  $vid = intval($form_state['values']['vid']);

  // Do not proceed for invalid role IDs, and do not allow the global default
  // to be deleted.
  if (!$vid || !$rid || empty($roles[$rid])) {
    return FALSE;
  }
  if ($form_state['values']['confirm']) {
    $form_state['redirect'] = TAXONOMY_ACCESS_CONFIG;
    if (taxonomy_access_disable_vocab($vid, $rid)) {
      drupal_set_message(t('All Taxonomy access rules deleted for %vocab in role %role.', array(
        '%vocab' => $form_state['values']['vocab_name'],
        '%role' => $roles[$rid],
      )));
      return TRUE;
    }
  }
}