You are here

function yandex_metrics_authorization_submit in Yandex.Metrics 6

Same name and namespace in other branches
  1. 7 yandex_metrics.module \yandex_metrics_authorization_submit()

Implementation of hook_submit for yandex_metrics_authorization form.

_state

Parameters

array $form:

File

./yandex_metrics.module, line 720
The main code of Yandex.Metrics module.

Code

function yandex_metrics_authorization_submit($form, &$form_state) {
  variable_set('yandex_metrics_client_id', $form_state['values']['yandex_metrics_client_id']);
  variable_set('yandex_metrics_client_secret', $form_state['values']['yandex_metrics_client_secret']);
  $client_id = variable_get('yandex_metrics_client_id', '');
  if (empty($client_id)) {
    drupal_set_message(t("Please set Client ID first."));
    return;
  }
  $request_url = "https://oauth.yandex.ru/authorize?response_type=code&client_id=" . $client_id;
  drupal_goto($request_url);
}