You are here

function context_ui_confirm in Context 6.2

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

Provide a form to confirm one of the provided actions.

1 string reference to 'context_ui_confirm'
context_ui_menu in context_ui/context_ui.module
Implementation of hook_menu().

File

context_ui/context_ui.admin.inc, line 505

Code

function context_ui_confirm(&$form_state, $op = 'delete', $context) {
  $form = array();
  $form['context'] = array(
    '#type' => 'value',
    '#value' => $context,
  );
  $form['action'] = array(
    '#type' => 'value',
    '#value' => $op,
  );
  switch ($op) {
    case 'delete':
      $contexts = context_contexts();
      switch ($contexts["{$context->namespace}-{$context->attribute}-{$context->value}"]->type) {
        case CONTEXT_STORAGE_OVERRIDDEN:
          $action = t('revert');
          $message = t('This action will permanently remove any customizations made to this context.');
          break;
        default:
          $action = t('delete');
          $message = t('This action will remove this context permanently from your site.');
          break;
      }
      break;
    case 'disable':
      $action = t('disable');
      $message = '';
      break;
    case 'enable':
      $action = t('enable');
      $message = '';
      break;
  }
  $form = confirm_form($form, t('Are you sure you want to !action the context %title?', array(
    '%title' => $context->value,
    '!action' => $action,
  )), 'admin/build/context', $message, drupal_ucfirst($action), t('Cancel'));
  return $form;
}