You are here

function rate_widget_delete_form_submit in Rate 7

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

Submit handler.

File

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

Code

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

    // Let other modules act on this action.
    module_invoke_all('rate_widget_delete', $widget);
  }
  $form_state['redirect'] = RATE_PATH_ADMIN_PAGE;
}