You are here

public function DownloadCountSettingsForm::buildForm in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  2. 8.2 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  3. 8.3 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  4. 8.4 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  5. 8.5 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  6. 8.6 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  7. 8.7 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  8. 8.8 modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  9. 10.3.x modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  10. 10.0.x modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  11. 10.1.x modules/custom/download_count/src/Form/DownloadCountSettingsForm.php \Drupal\download_count\Form\DownloadCountSettingsForm::buildForm()
  12. 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\Form

Code

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);
}