function StatisticsSettingsForm::buildForm

Same name in other branches
  1. 8.9.x core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::buildForm()
  2. 10 core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::buildForm()
  3. 11.x core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::buildForm()

Overrides ConfigFormBase::buildForm

File

core/modules/statistics/src/StatisticsSettingsForm.php, line 66

Class

StatisticsSettingsForm
Configure statistics settings for this site.

Namespace

Drupal\statistics

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('statistics.settings');
    // Content counter settings.
    $form['content'] = [
        '#type' => 'details',
        '#title' => $this->t('Content viewing counter settings'),
        '#open' => TRUE,
    ];
    $form['content']['statistics_count_content_views'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Count content views'),
        '#default_value' => $config->get('count_content_views'),
        '#description' => $this->t('Increment a counter each time content is viewed.'),
    ];
    return parent::buildForm($form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.