You are here

function patterns_yamlparser_parse in Patterns 7.2

Same name and namespace in other branches
  1. 7 patterns_yamlparser/patterns_yamlparser.module \patterns_yamlparser_parse()

Parses a string representing a YAML pattern and return the array representation.

Parameters

array $pattern The pattern string to convert array.:

File

patterns_yamlparser/patterns_yamlparser.module, line 69

Code

function patterns_yamlparser_parse($pattern) {
  $library = libraries_load('spyc');
  if (!empty($library['loaded'])) {
    if (!is_array($pattern)) {
      $pattern = Spyc::YAMLLoad($pattern);
    }
  }
  else {
    watchdog('Patterns', 'Spyc library not found while trying to parse.', array(), WATCHDOG_ERROR);
    return FALSE;
  }
  return $pattern;
}