function patterns_yamlparser_load in Patterns 7.2
Same name and namespace in other branches
- 7 patterns_yamlparser/patterns_yamlparser.module \patterns_yamlparser_load()
Loads and parses a YAML pattern from file.
Parameters
string $path The path to the pattern file.:
bool $local (optional) TRUE if the pattern: file is local. Defaults to TRUE.
Return value
array|bool The pattern structure, or FALSE.
File
- patterns_yamlparser/
patterns_yamlparser.module, line 47
Code
function patterns_yamlparser_load($path, $local = TRUE) {
if ($local && !file_exists($path)) {
return FALSE;
}
$library = libraries_load('spyc');
if (!empty($library['loaded'])) {
return Spyc::YAMLLoad($path);
}
else {
watchdog('Patterns', 'Spyc library not found while trying to load the file.', array(), WATCHDOG_ERROR);
return FALSE;
}
}