You are here

public function TextFormat::getFormats in YAML Form 8

Get an element's available formats.

Return value

array An associative array of formats containing name/label pairs.

Overrides YamlFormElementBase::getFormats

File

src/Plugin/YamlFormElement/TextFormat.php, line 143

Class

TextFormat
Provides a 'text_format' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getFormats() {
  $filters = FilterFormat::loadMultiple();
  $formats = parent::getFormats();
  foreach ($filters as $filter) {
    $formats[$filter
      ->id()] = $filter
      ->label();
  }
  return $formats;
}