public function CounterSettingsAdvanced::buildForm in Counter 8
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
- src/
Form/ CounterSettingsAdvanced.php, line 33
Class
- CounterSettingsAdvanced
- Class AddForm.
Namespace
Drupal\counter\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('counter.settings');
// Generate the form - settings applying to all patterns first.
$form['counter_advanced'] = array(
'#type' => 'details',
'#weight' => -20,
'#title' => t('Advanced settings'),
);
$form['counter_advanced']['counter_skip_admin'] = array(
'#type' => 'checkbox',
'#title' => t('Skip admin'),
'#default_value' => $config
->get('counter_skip_admin'),
'#description' => t("Do not count when visitor is admin (uid=1)."),
);
$form['counter_advanced']['counter_refresh_delay'] = array(
'#type' => 'textfield',
'#title' => t('Delay before refresh counter data (in second)'),
'#default_value' => $config
->get('counter_refresh_delay'),
'#description' => t("Delay before re-calculate counter data, otherwise read from previous value."),
);
$form['counter_advanced']['counter_insert_delay'] = array(
'#type' => 'textfield',
'#title' => t('Delay before next insert (in second)'),
'#default_value' => $config
->get('counter_insert_delay'),
'#description' => t("Wait for certain second before next insert. Increase this value if your server can not handle too much data recording. Set to 0 for no delay."),
);
return parent::buildForm($form, $form_state);
}