public function FileMimeConfigForm::buildForm in File MIME 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/ FileMimeConfigForm.php, line 30
Class
- FileMimeConfigForm
- Implements the file MIME config form.
Namespace
Drupal\filemime\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['file'] = [
'#default_value' => $this
->config('filemime.settings')
->get('file'),
'#description' => $this
->t('If a mime.types file is readable, it will be parsed to extract MIME type mappings. Example: <em>/etc/mime.types</em>') . '<br />' . (is_readable($this
->config('filemime.settings')
->get('file')) ? $this
->t('The configured mime.types file is readable.') : $this
->t('The configured mime.types file is not readable.')),
'#title' => $this
->t('Local mime.types file path'),
'#type' => 'textfield',
];
$form['types'] = [
'#default_value' => $this
->config('filemime.settings')
->get('types'),
'#description' => $this
->t('Types provided here will override the mime.types file. Specify the mappings using the mime.types file format. Example:<br /><em>audio/mpeg mpga mpega mp2 mp3 m4a<br />audio/mpegurl m3u<br />audio/ogg oga ogg opus spx</em>'),
'#title' => $this
->t('Custom MIME type mappings'),
'#type' => 'textarea',
];
return parent::buildForm($form, $form_state);
}