function statistics_settings_form

Form constructor for the statistics administration form.

See also

statistics_settings_form_submit().

Related topics

1 string reference to 'statistics_settings_form'
statistics_menu in drupal/core/modules/statistics/statistics.module
Implements hook_menu().

File

drupal/core/modules/statistics/statistics.admin.inc, line 330
Admin page callbacks for the Statistics module.

Code

function statistics_settings_form($form, &$form_state) {
  $config = config('statistics.settings');

  // Access log settings.
  $form['access'] = array(
    '#type' => 'details',
    '#title' => t('Access log settings'),
  );
  $form['access']['statistics_enable_access_log'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable access log'),
    '#default_value' => $config
      ->get('access_log.enabled'),
    '#description' => t('Log each page access. Required for referrer statistics.'),
  );
  $form['access']['statistics_flush_accesslog_timer'] = array(
    '#type' => 'select',
    '#title' => t('Discard access logs older than'),
    '#default_value' => $config
      ->get('access_log.max_lifetime'),
    '#options' => array(
      0 => t('Never'),
    ) + drupal_map_assoc(array(
      3600,
      10800,
      21600,
      32400,
      43200,
      86400,
      172800,
      259200,
      604800,
      1209600,
      2419200,
      4838400,
      9676800,
    ), 'format_interval'),
    '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. (Requires a correctly configured <a href="@cron">cron maintenance task</a>.)', array(
      '@cron' => url('admin/reports/status'),
    )),
  );

  // Content counter settings.
  $form['content'] = array(
    '#type' => 'details',
    '#title' => t('Content viewing counter settings'),
  );
  $form['content']['statistics_count_content_views'] = array(
    '#type' => 'checkbox',
    '#title' => t('Count content views'),
    '#default_value' => $config
      ->get('count_content_views'),
    '#description' => t('Increment a counter each time content is viewed.'),
  );
  return system_config_form($form, $form_state);
}