public function MediaSubFormManager::forceFieldsAsOptional in Media Bulk Upload 8
Make sure the fields are optional, instead of required.
Parameters
array $elements: The form elements to check the required settings on.
Return value
$this MediaSubFormManager.
Overrides MediaSubFormManagerInterface::forceFieldsAsOptional
1 call to MediaSubFormManager::forceFieldsAsOptional()
- MediaSubFormManager::configureSharedFields in src/
MediaSubFormManager.php - Configure all the shared fields.
File
- src/
MediaSubFormManager.php, line 240
Class
- MediaSubFormManager
- Class MediaSubFormManager.
Namespace
Drupal\media_bulk_uploadCode
public function forceFieldsAsOptional(array &$elements) {
if (isset($elements['#required'])) {
$elements['#required'] = FALSE;
}
$children = Element::children($elements);
foreach ($children as $child) {
$this
->forceFieldsAsOptional($elements[$child]);
}
return $this;
}