You are here

function oauth_common_form_authorization_delete in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.authorizations.inc \oauth_common_form_authorization_delete()
  2. 7.3 oauth_common.authorizations.inc \oauth_common_form_authorization_delete()
1 string reference to 'oauth_common_form_authorization_delete'
oauth_common_providerui_menu in ./oauth_common_providerui.module
Implementation of hook_menu().

File

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

Code

function oauth_common_form_authorization_delete($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,
  )));
  $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',
    '#value' => t('Are you sure that you want to delete the authorization for "@consumer"?', array(
      '@consumer' => $consumer->name,
    )),
  );
  $form['cancel'] = array(
    '#type' => 'item',
    '#value' => l(t('Cancel'), sprintf($cancel_url, $user->uid, $token->tid)),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
  );
  return $form;
}