function MediaLibrarySelectForm::viewsFormValidate
Same name in other branches
- 8.9.x core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php \Drupal\media_library\Plugin\views\field\MediaLibrarySelectForm::viewsFormValidate()
- 10 core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php \Drupal\media_library\Plugin\views\field\MediaLibrarySelectForm::viewsFormValidate()
- 11.x core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php \Drupal\media_library\Plugin\views\field\MediaLibrarySelectForm::viewsFormValidate()
File
-
core/
modules/ media_library/ src/ Plugin/ views/ field/ MediaLibrarySelectForm.php, line 133
Class
- MediaLibrarySelectForm
- Defines a field that outputs a checkbox and form for selecting media.
Namespace
Drupal\media_library\Plugin\views\fieldCode
public function viewsFormValidate(array &$form, FormStateInterface $form_state) {
$selected = array_filter($form_state->getValue($this->options['id']));
if (empty($selected)) {
$form_state->setErrorByName('', $this->t('No items selected.'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.