You are here

function context_ui_confirm_submit in Context 6.2

Same name and namespace in other branches
  1. 6 context_ui/context_ui.admin.inc \context_ui_confirm_submit()

Submit handler for the context_ui_confirm form.

File

context_ui/context_ui.admin.inc, line 544

Code

function context_ui_confirm_submit($form, &$form_state) {
  switch ($form_state['values']['action']) {
    case 'delete':
      context_delete_context($form_state['values']['context']);
      break;
    case 'disable':
    case 'enable':
      $context = $form_state['values']['context'];
      if ($context) {
        $status = variable_get('context_status', array());
        $status["{$context->namespace}-{$context->attribute}-{$context->value}"] = $form_state['values']['action'] == 'disable' ? CONTEXT_STATUS_DISABLED : CONTEXT_STATUS_ENABLED;
        variable_set('context_status', $status);
        context_invalidate_cache();
      }
      break;
  }
  $form_state['redirect'] = 'admin/build/context';
}