You are here

public function FileWidget::settingsForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php \Drupal\file\Plugin\Field\FieldWidget\FileWidget::settingsForm()
  2. 9 core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php \Drupal\file\Plugin\Field\FieldWidget\FileWidget::settingsForm()

Returns a form to configure settings for the widget.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. The field_ui module takes care of handling submitted form values.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form definition for the widget settings.

Overrides WidgetBase::settingsForm

File

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

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['progress_indicator'] = [
    '#type' => 'radios',
    '#title' => t('Progress indicator'),
    '#options' => [
      'throbber' => t('Throbber'),
      'bar' => t('Bar with progress meter'),
    ],
    '#default_value' => $this
      ->getSetting('progress_indicator'),
    '#description' => 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,
    '#access' => file_progress_implementation(),
  ];
  return $element;
}