You are here

function oauth_common_form_authorization_delete in OAuth 1.0 7.4

Same name and namespace in other branches
  1. 6.3 oauth_common.authorizations.inc \oauth_common_form_authorization_delete()
  2. 7.3 oauth_common.authorizations.inc \oauth_common_form_authorization_delete()

Provide a form for deleting an authorization.

We've got the same symptom here that we do with `oauth_common_form_authorization`, i.e., this is actually called by `drupal_retrieve_form`.

1 string reference to 'oauth_common_form_authorization_delete'
oauth_common_providerui_menu in ./oauth_common_providerui.module
Implements hook_menu().

File

./oauth_common.authorizations.inc, line 230
Functions related to a user's authorization section

Code

function oauth_common_form_authorization_delete($form_id, &$form_state, $user, $token) {
  $consumer = $token->consumer;
  $cancel_url = 'user/%d/oauth/authorizations';
  if (!empty($_GET['destination'])) {
    $cancel_url = $_GET['destination'];
  }
  drupal_set_title(t('Deleting authorization for "@consumer"', array(
    '@consumer' => $consumer->name,
  )), PASS_THROUGH);
  $form = array(
    'token_object' => array(
      '#type' => 'value',
      '#value' => $token,
    ),
  );
  $form['user'] = array(
    '#type' => 'value',
    '#value' => $user->uid,
  );
  $form['key'] = array(
    '#type' => 'value',
    '#value' => $token->key,
  );
  $form['description'] = array(
    '#type' => 'item',
    '#markup' => t('Are you sure that you want to delete the authorization for "@consumer"?', array(
      '@consumer' => $consumer->name,
    )),
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['cancel'] = array(
    '#markup' => l(t('Cancel'), sprintf($cancel_url, $user->uid, $token->key)),
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
  );
  return $form;
}