public function DownloadCountSettingsForm::buildForm in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 8.2 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 8.3 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 8.4 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 8.5 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 8.6 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 8.7 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 8.8 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 10.3.x modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 10.0.x modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 10.1.x modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
- 10.2.x modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::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
- modules/
custom/ download_count/ src/ Form/ DownloadCountSettingsForm.php, line 30
Class
- DownloadCountSettingsForm
- Configure download count settings.
Namespace
Drupal\download_count\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('download_count.settings');
$form['excluded file extensions'] = [
'#type' => 'details',
'#title' => $this
->t('Excluded file extensions'),
'#open' => TRUE,
];
$form['excluded file extensions']['download_count_excluded_file_extensions'] = [
'#type' => 'textfield',
'#title' => $this
->t('Excluded file extensions'),
'#default_value' => $config
->get('download_count_excluded_file_extensions'),
'#maxlength' => 255,
'#description' => $this
->t("To exclude files of certain types, enter the extensions to exclude separated by spaces. This is useful if you have private image fields and don't wish to include them in download counts."),
];
$form['download_count_flood_control'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Flood Control Settings'),
'#open' => FALSE,
];
$form['download_count_flood_control']['download_count_flood_limit'] = [
'#type' => 'textfield',
'#title' => $this
->t('Flood control limit'),
'#size' => 10,
'#default_value' => $config
->get('download_count_flood_limit'),
'#description' => $this
->t('Maximum number of times to count the file download per time window. Enter 0 for no flood control limits.'),
];
$form['download_count_flood_control']['download_count_flood_window'] = [
'#type' => 'textfield',
'#title' => $this
->t('Flood control window'),
'#size' => 10,
'#default_value' => $config
->get('download_count_flood_window'),
'#description' => $this
->t('Number of seconds in the time window for counting a file download.'),
];
return parent::buildForm($form, $form_state);
}