You are here

public function StatisticsSettingsForm::buildForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

core/modules/statistics/src/StatisticsSettingsForm.php, line 68
Contains \Drupal\statistics\StatisticsSettingsForm.

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'] = array(
    '#type' => 'details',
    '#title' => t('Content viewing counter settings'),
    '#open' => TRUE,
  );
  $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 parent::buildForm($form, $form_state);
}