function patterns_yamlparser_dump in Patterns 7.2
Same name and namespace in other branches
- 7 patterns_yamlparser/patterns_yamlparser.module \patterns_yamlparser_dump()
Converts an array representing a pattern into a YAML string.
Parameters
array $pattern The pattern to convert into a YAML string:
mixed $append (optional) A string to which the dump : will be appended. Defaults NULL
Return value
mixed $dump A string representation of the pattern.
File
- patterns_yamlparser/
patterns_yamlparser.module, line 91
Code
function patterns_yamlparser_dump($pattern = NULL, $append = NULL) {
if (is_null($pattern) || !is_array($pattern)) {
return FALSE;
}
$dump = empty($append) ? '' : $append . "\n";
$library = libraries_load('spyc');
if (!empty($library['loaded'])) {
$dump .= Spyc::YAMLDump($pattern);
return $dump;
}
else {
watchdog('Patterns', 'Spyc library not found while trying to dump.', array(), WATCHDOG_ERROR);
return FALSE;
}
}