You are here

public function YamlFormManagedFileBase::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/YamlFormManagedFileBase.php, line 154

Class

YamlFormManagedFileBase
Provides a base class form 'managed_file' elements.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function setDefaultValue(array &$element) {
  if (!empty($element['#default_value']) && !is_array($element['#default_value'])) {
    $element['#default_value'] = [
      $element['#default_value'],
    ];
  }
}