public function TextFormat::setDefaultValue in YAML Form 8
Set an element's default value using saved data.
Parameters
array $element: An element.
Overrides YamlFormElementBase::setDefaultValue
File
- src/
Plugin/ YamlFormElement/ TextFormat.php, line 86
Class
- TextFormat
- Provides a 'text_format' element.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
public function setDefaultValue(array &$element) {
if (isset($element['#default_value']) && is_array($element['#default_value'])) {
if (isset($element['#default_value']['format'])) {
$element['#format'] = $element['#default_value']['format'];
}
if (isset($element['#default_value']['value'])) {
$element['#default_value'] = $element['#default_value']['value'];
}
}
}