You are here

function oauth2_server_authorize_form in OAuth2 Server 7

Form callback: Returns the authorize form.

Parameters

$client: The client entity for this request.

$server: The server entity for this request.

$scopes: An array of scope entities representing scopes to be granted by the user.

1 string reference to 'oauth2_server_authorize_form'
oauth2_server_authorize_page in ./oauth2_server.pages.inc
Page callback: Authenticates the user and redirect back to the client with an authorization code.

File

./oauth2_server.pages.inc, line 93
Page callbacks for the OAuth2 Server module.

Code

function oauth2_server_authorize_form($form, &$form_state, $client, $server, $scopes) {
  drupal_set_title(t('Authorize @client to use your account?', array(
    '@client' => $client->label,
  )));
  $list = array(
    'title' => t('This application will be able to:'),
    'items' => array(),
    'type' => 'ul',
  );
  foreach ($scopes as $scope) {
    $list['items'][] = array(
      'data' => $scope
        ->getTranslation('description'),
    );
  }
  $form['scopes'] = array(
    '#markup' => theme('item_list', $list),
  );
  $form['authorize'] = array(
    '#type' => 'submit',
    '#value' => t('Yes, I authorize this request.'),
    '#authorized' => TRUE,
  );
  $form['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#authorized' => FALSE,
  );
  return $form;
}