You are here

public function FileUrlWidget::formMultipleElements in File URL 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/FileUrlWidget.php \Drupal\file_url\Plugin\Field\FieldWidget\FileUrlWidget::formMultipleElements()

Overrides \Drupal\Core\Field\WidgetBase::formMultipleElements().

Special handling for draggable multiple widgets and 'add more' button.

Overrides FileWidget::formMultipleElements

File

src/Plugin/Field/FieldWidget/FileUrlWidget.php, line 69

Class

FileUrlWidget
Plugin implementation of the 'file_url_generic' widget.

Namespace

Drupal\file_url\Plugin\Field\FieldWidget

Code

public function formMultipleElements(FieldItemListInterface $items, array &$form, FormStateInterface $form_state) {
  $elements = parent::formMultipleElements($items, $form, $form_state);

  // Use the configurable 'new item' label.
  $elements['#file_upload_title'] = $this
    ->getSetting('add_new_label');

  // The upload instructions are added directly to 'file_url' element.
  unset($elements['#file_upload_description']);
  return $elements;
}