function FileWidget::settingsForm

Overrides WidgetBase::settingsForm

1 call to FileWidget::settingsForm()
ImageWidget::settingsForm in core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
Returns a form to configure settings for the widget.
1 method overrides FileWidget::settingsForm()
ImageWidget::settingsForm in core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
Returns a form to configure settings for the widget.

File

core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php, line 63

Class

FileWidget
Plugin implementation of the 'file_generic' widget.

Namespace

Drupal\file\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element['notice'] = [
    '#type' => 'container',
    '#markup' => $this->t('The UploadProgress PHP extension must be enabled to configure the progress indicator. Check the <a href=":status">status report</a> for more information.', [
      ':status' => Url::fromRoute('system.status')->toString(),
    ]),
    '#weight' => 16,
    '#access' => !extension_loaded('uploadprogress'),
    '#attributes' => [
      'role' => 'status',
    ],
  ];
  $element['progress_indicator'] = [
    '#type' => 'radios',
    '#title' => $this->t('Progress indicator'),
    '#options' => [
      'throbber' => $this->t('Throbber'),
      'bar' => $this->t('Bar with progress meter'),
    ],
    '#default_value' => $this->getSetting('progress_indicator'),
    '#description' => $this->t('The throbber display does not show the status of uploads but takes up less space. The progress bar is helpful for monitoring progress on large uploads.'),
    '#weight' => 16,
    '#disabled' => !extension_loaded('uploadprogress'),
  ];
  return $element;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.