You are here

function google_analytics_reports_plugin_query_google_analytics::options_form in Google Analytics Reports 7.3

Add settings for the ui.

Overrides views_plugin_query::options_form

File

plugins/google_analytics_reports_plugin_query_google_analytics.inc, line 321
Defines the default query object which builds queries for the Google Analytics Reports API.

Class

google_analytics_reports_plugin_query_google_analytics
Object used to create a Google Analytics Core Reporting API query.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Load profiles list.
  module_load_include('inc', 'google_analytics_reports_api', 'google_analytics_reports_api.admin');
  $profile_list = google_analytics_reports_api_profiles_list();
  if ($profile_list) {
    $form['reports_profile'] = array(
      '#title' => t('Use another reports profile'),
      '#description' => t('This view will use another reports profile rather than system default profile: %profile.', array(
        '%profile' => theme('google_analytics_reports_api_profile_label', array(
          'profile' => $profile_list['current_profile'],
          'active' => TRUE,
        )),
      )),
      '#type' => 'checkbox',
      '#default_value' => !empty($this->options['reports_profile']),
    );
    $form['profile_id'] = array(
      '#type' => 'select',
      '#title' => t('Reports profile'),
      '#options' => $profile_list['options'],
      '#description' => t('Choose your Google Analytics profile.'),
      '#default_value' => $this->options['profile_id'],
      '#dependency' => array(
        'edit-query-options-reports-profile' => '1',
      ),
    );
  }
}