public function YamlFormEntityReferenceTrait::formatText in YAML Form 8
File
- src/
Plugin/ YamlFormElement/ YamlFormEntityReferenceTrait.php, line 70
Class
- YamlFormEntityReferenceTrait
- Provides an 'entity_reference' trait.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
public function formatText(array &$element, $value, array $options = []) {
if (empty($value)) {
return '';
}
$items = $this
->formatItems($element, $value, $options);
// Add dash (aka bullet) before each item.
if ($this
->isMultiline($element)) {
foreach ($items as &$item) {
$item = '- ' . $item;
}
}
return implode("\n", $items);
}