You are here

function rate_widget_delete_form_submit in Rate 6.2

Same name and namespace in other branches
  1. 7 rate.admin.inc \rate_widget_delete_form_submit()

Submit handler.

File

./rate.admin.inc, line 747
Rating admin

Code

function rate_widget_delete_form_submit($form, &$form_state) {
  $widgets = variable_get(RATE_VAR_WIDGETS, array());
  if ($title = $widgets[$form['#widget_id']]->title) {
    unset($widgets[$form['#widget_id']]);
    variable_set(RATE_VAR_WIDGETS, $widgets);
    drupal_set_message(t('Widget %title has been deleted.', array(
      '%title' => $title,
    )));

    // Let other modules act on this action.
    foreach (module_implements('rate_widget') as $module) {
      $hook = "{$module}_rate_widget";
      $hook('delete', $widgets[$form['#widget_id']], $form_state['values']);
    }
  }
  $form_state['redirect'] = RATE_PATH_ADMIN_PAGE;
}