You are here

function yandex_metrics_reports_reports in Yandex.Metrics 8.3

Same name and namespace in other branches
  1. 6.2 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_reports()
  2. 7.3 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_reports()
  3. 7.2 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_reports()

Menu callback. Reports setting form.

1 string reference to 'yandex_metrics_reports_reports'
yandex_metrics_reports_menu in yandex_metrics_reports/yandex_metrics_reports.module
Implements hook_menu().

File

yandex_metrics_reports/yandex_metrics_reports.module, line 358
The main code of Yandex.Metrics Reports module.

Code

function yandex_metrics_reports_reports() {
  $form = array();
  $reports = yandex_metrics_reports_get_list();
  foreach ($reports as $report_name => $report_data) {
    $form['reports'][$report_name]['yandex_metrics_reports_' . $report_name . '_visible'] = array(
      '#type' => 'checkbox',
      '#title' => check_plain($report_data['title']),
      '#default_value' => isset($report_data['visible']) && !$report_data['visible'] ? FALSE : TRUE,
    );
    $form['reports'][$report_name]['yandex_metrics_reports_' . $report_name . '_weight'] = array(
      '#type' => 'weight',
      '#delta' => 100,
      '#default_value' => (int) $report_data['weight'],
      '#attributes' => array(
        'class' => array(
          'yandex-metrics-reports-report-weight',
        ),
      ),
    );
  }
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset to default'),
  );
  return $form;
}