You are here

function yandex_metrics_reports_reports_submit in Yandex.Metrics 8.3

Same name and namespace in other branches
  1. 7.3 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_reports_submit()

Submit handler for yandex_metrics_reports_reports form.

File

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

Code

function yandex_metrics_reports_reports_submit($form, &$form_state) {
  $values = $form_state['values'];
  if ($values['op'] == t('Reset to default')) {
    yandex_metrics_reports_get_list(TRUE);
    return;
  }
  $reports = yandex_metrics_reports_get_list();
  foreach ($reports as $report_name => $report_data) {
    $reports[$report_name]['visible'] = $values['yandex_metrics_reports_' . $report_name . '_visible'];
    $reports[$report_name]['weight'] = $values['yandex_metrics_reports_' . $report_name . '_weight'];
  }
  yandex_metrics_reports_sort_and_save($reports);
}