public function Upload::buildConfigurationForm in Entity Browser 8
Same name and namespace in other branches
- 8.2 src/Plugin/EntityBrowser/Widget/Upload.php \Drupal\entity_browser\Plugin\EntityBrowser\Widget\Upload::buildConfigurationForm()
Implements PluginFormInterface::buildConfigurationForm().
Overrides WidgetBase::buildConfigurationForm
File
- src/
Plugin/ EntityBrowser/ Widget/ Upload.php, line 166
Class
- Upload
- Adds an upload field browser's widget.
Namespace
Drupal\entity_browser\Plugin\EntityBrowser\WidgetCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['upload_location'] = [
'#type' => 'textfield',
'#title' => $this
->t('Upload location'),
'#default_value' => $this->configuration['upload_location'],
];
$form['multiple'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Accept multiple files'),
'#default_value' => $this->configuration['multiple'],
'#description' => $this
->t('Multiple uploads will only be accepted if the source field allows more than one value.'),
];
$form['extensions'] = [
'#type' => 'textfield',
'#title' => $this
->t('Allowed file extensions'),
'#description' => $this
->t('Separate extensions with a space or comma and do not include the leading dot.'),
'#default_value' => $this->configuration['extensions'],
'#element_validate' => [
[
static::class,
'validateExtensions',
],
],
'#required' => TRUE,
];
if ($this->moduleHandler
->moduleExists('token')) {
$form['token_help'] = [
'#theme' => 'token_tree_link',
'#token_types' => [
'file',
],
];
$form['upload_location']['#description'] = $this
->t('You can use tokens in the upload location.');
}
return $form;
}