You are here

function trigger_unassign_submit in Drupal 7

Same name and namespace in other branches
  1. 6 modules/trigger/trigger.admin.inc \trigger_unassign_submit()

Form submission handler for trigger_unassign().

File

modules/trigger/trigger.admin.inc, line 89
Admin page callbacks for the trigger module.

Code

function trigger_unassign_submit($form, &$form_state) {
  if ($form_state['values']['confirm'] == 1) {
    $aid = actions_function_lookup($form_state['values']['aid']);
    db_delete('trigger_assignments')
      ->condition('hook', $form_state['values']['hook'])
      ->condition('aid', $aid)
      ->execute();
    drupal_static_reset('trigger_get_assigned_actions');
    $actions = actions_get_all_actions();
    watchdog('actions', 'Action %action has been unassigned.', array(
      '%action' => $actions[$aid]['label'],
    ));
    drupal_set_message(t('Action %action has been unassigned.', array(
      '%action' => $actions[$aid]['label'],
    )));
    $form_state['redirect'] = 'admin/structure/trigger/' . $form_state['values']['module'];
  }
  else {
    drupal_goto('admin/structure/trigger');
  }
}