public function FileHashConfigForm::buildForm in File Hash 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/ FileHashConfigForm.php, line 58
Class
- FileHashConfigForm
- Implements the file hash config form.
Namespace
Drupal\filehash\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['algos'] = [
'#default_value' => $this
->config('filehash.settings')
->get('algos'),
'#description' => $this
->t('The checked hash algorithm(s) will be calculated when a file is saved. For optimum performance, only enable the hash algorithm(s) you need.'),
'#options' => filehash_names(),
'#title' => $this
->t('Enabled hash algorithms'),
'#type' => 'checkboxes',
];
$form['dedupe'] = [
'#default_value' => $this
->config('filehash.settings')
->get('dedupe'),
'#description' => $this
->t('If checked, prevent duplicate uploaded files from being saved. Note, enabling this setting has privacy implications, as it allows users to determine if a particular file has been uploaded to the site.'),
'#title' => $this
->t('Disallow duplicate files'),
'#type' => 'checkbox',
];
return parent::buildForm($form, $form_state);
}