public function WebformTwigExtension::webformDebug in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Twig/WebformTwigExtension.php \Drupal\webform\Twig\WebformTwigExtension::webformDebug()
Debug data by outputting YAML.
Parameters
mixed $data: Data to be outputted.
Return value
string Data serialized to YAML.
File
- src/
Twig/ WebformTwigExtension.php, line 69
Class
- WebformTwigExtension
- Twig extension with some useful functions and filters.
Namespace
Drupal\webform\TwigCode
public function webformDebug($data) {
try {
if (is_array($data)) {
WebformElementHelper::convertRenderMarkupToStrings($data);
return WebformYaml::encode($data);
}
else {
return $data;
}
} catch (\Exception $exception) {
return $exception
->getMessage();
}
}