public function StatisticsSettingsForm::buildForm in Drupal 8
Same name and namespace in other branches
- 9 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 66
Class
- StatisticsSettingsForm
- Configure statistics settings for this site.
Namespace
Drupal\statisticsCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('statistics.settings');
// Content counter settings.
$form['content'] = [
'#type' => 'details',
'#title' => t('Content viewing counter settings'),
'#open' => TRUE,
];
$form['content']['statistics_count_content_views'] = [
'#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);
}