protected function YamlFormManagedFileBase::prepareWrapper in YAML Form 8
Set an elements Flexbox and #states wrapper.
Parameters
array $element: An element.
Overrides YamlFormElementBase::prepareWrapper
File
- src/
Plugin/ YamlFormElement/ YamlFormManagedFileBase.php, line 133
Class
- YamlFormManagedFileBase
- Provides a base class form 'managed_file' elements.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
protected function prepareWrapper(array &$element) {
parent::prepareWrapper($element);
// Issue #2705471: Form states managed file fields.
// Workaround: Wrap the 'managed_file' element in a basic container.
if (!empty($element['#fixed_wrapper']) || empty($element['#prefix'])) {
return;
}
$container = [
'#prefix' => $element['#prefix'],
'#suffix' => $element['#suffix'],
];
unset($element['#prefix'], $element['#suffix']);
$container[$element['#yamlform_key']] = $element + [
'#fixed_wrapper' => TRUE,
];
$element = $container;
}