public function WebformCodeMirror::getTestValues in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/WebformCodeMirror.php \Drupal\webform\Plugin\WebformElement\WebformCodeMirror::getTestValues()
Get test values for an element.
Parameters
array $element: An element.
\Drupal\webform\WebformInterface $webform: A webform.
array $options: Options used to generate a test value.
Return value
mixed A test value for an element.
Overrides WebformElementBase::getTestValues
File
- src/
Plugin/ WebformElement/ WebformCodeMirror.php, line 103
Class
- WebformCodeMirror
- Provides a 'webform_codemirror' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function getTestValues(array $element, WebformInterface $webform, array $options = []) {
$element += [
'#mode' => 'text',
];
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 [];
}
}