You are here

public function YamlFormCodeMirror::getTestValue in YAML Form 8

Get test value for an element.

Parameters

array $element: An element.

\Drupal\yamlform\YamlFormInterface $yamlform: A form.

Return value

mixed A test value for an element.

Overrides YamlFormElementBase::getTestValue

File

src/Plugin/YamlFormElement/YamlFormCodeMirror.php, line 72

Class

YamlFormCodeMirror
Provides a 'yamlform_codemirror' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getTestValue(array $element, YamlFormInterface $yamlform) {
  switch ($element['#mode']) {
    case 'html':
      return '<p><b>Hello World!!!</b></p>';
    case 'yaml':
      return "message: 'Hello World'";
    case 'text':
      return "Hello World";
    default:
      return '';
  }
}