function MediaLibraryInceptionWidget::formElement

Same name in other branches
  1. 9 core/modules/media_library/tests/modules/media_library_test_widget/src/Plugin/Field/FieldWidget/MediaLibraryInceptionWidget.php \Drupal\media_library_test_widget\Plugin\Field\FieldWidget\MediaLibraryInceptionWidget::formElement()
  2. 8.9.x core/modules/media_library/tests/modules/media_library_test_widget/src/Plugin/Field/FieldWidget/MediaLibraryInceptionWidget.php \Drupal\media_library_test_widget\Plugin\Field\FieldWidget\MediaLibraryInceptionWidget::formElement()
  3. 10 core/modules/media_library/tests/modules/media_library_test_widget/src/Plugin/Field/FieldWidget/MediaLibraryInceptionWidget.php \Drupal\media_library_test_widget\Plugin\Field\FieldWidget\MediaLibraryInceptionWidget::formElement()

Overrides MediaLibraryWidget::formElement

File

core/modules/media_library/tests/modules/media_library_test_widget/src/Plugin/Field/FieldWidget/MediaLibraryInceptionWidget.php, line 33

Class

MediaLibraryInceptionWidget
Plugin implementation of the 'media_library_inception_widget' widget.

Namespace

Drupal\media_library_test_widget\Plugin\Field\FieldWidget

Code

public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    if (empty($element['#element_validate'])) {
        $element['#element_validate'] = [];
    }
    $element['#element_validate'][] = [
        $this,
        'elementValidate',
    ];
    return parent::formElement($items, $delta, $element, $form, $form_state);
}

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