protected function YamlFormElementBase::prepareWrapper in YAML Form 8
Set an elements Flexbox and #states wrapper.
Parameters
array $element: An element.
2 calls to YamlFormElementBase::prepareWrapper()
- YamlFormElementBase::prepare in src/
YamlFormElementBase.php - Prepare an element to be rendered within a form.
- YamlFormManagedFileBase::prepareWrapper in src/
Plugin/ YamlFormElement/ YamlFormManagedFileBase.php - Set an elements Flexbox and #states wrapper.
1 method overrides YamlFormElementBase::prepareWrapper()
- YamlFormManagedFileBase::prepareWrapper in src/
Plugin/ YamlFormElement/ YamlFormManagedFileBase.php - Set an elements Flexbox and #states wrapper.
File
- src/
YamlFormElementBase.php, line 490
Class
- YamlFormElementBase
- Provides a base class for a form element.
Namespace
Drupal\yamlformCode
protected function prepareWrapper(array &$element) {
// Fix #states wrapper.
if ($this->pluginDefinition['states_wrapper']) {
YamlFormElementHelper::fixStatesWrapper($element);
}
// Add flex(box) wrapper.
if (!empty($element['#yamlform_parent_flexbox'])) {
$flex = isset($element['#flex']) ? $element['#flex'] : 1;
$element += [
'#prefix' => '',
'#suffix' => '',
];
$element['#prefix'] = '<div class="yamlform-flex yamlform-flex--' . $flex . '"><div class="yamlform-flex--container">' . $element['#prefix'];
$element['#suffix'] = $element['#suffix'] . '</div></div>';
}
}