You are here

function vkxp_admin_access_token in VK CrossPoster 6.3

Same name and namespace in other branches
  1. 7.2 vkxp.admin.inc \vkxp_admin_access_token()

Form for recieving access token from VK.

1 string reference to 'vkxp_admin_access_token'
vkxp_menu in ./vkxp.module
Implements hook_menu().

File

./vkxp.admin.inc, line 120
vkxp.admin.inc Contains VKXP settings form.

Code

function vkxp_admin_access_token($form_state) {
  $form = array();
  $html_id = 'access-token-form';
  $form['#prefix'] = '<div id="' . $html_id . '">';
  $form['#suffix'] = '</div>';

  // FIRST STEP.
  // Getting authorize code from VK.
  $params = array();
  $params['client_id'] = variable_get('vkxp_app_id', '');
  $params['scope'] = VKXP_AUTHORIZE_SCOPE;
  $params['redirect_uri'] = VKXP_AUTHORIZE_REDIRECT_URI;
  $params['response_type'] = VKXP_AUTHORIZE_RESPONSE_TYPE;
  $form['new_access_token'] = array(
    '#type' => 'fieldset',
    '#title' => t('Recieve new access token'),
    '#collapsible' => TRUE,
    '#collapsed' => variable_get('vkxp_access_token', '') ? TRUE : FALSE,
  );
  $form['new_access_token']['link'] = array(
    '#theme' => 'markup',
    '#value' => l('Get code', VKXP_AUTHORIZE_URI, array(
      'query' => $params,
      'html' => FALSE,
      'attributes' => array(
        'target' => '_blank',
      ),
    )),
  );
  $form['new_access_token']['code'] = array(
    '#type' => 'textfield',
    '#title' => t('Code'),
    '#description' => t('Copy #code param from the URL here.'),
  );
  $form['new_access_token']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Get access token'),
  );
  return $form;
}