You are here

function patterns_load_string_yaml in Patterns 6

Same name and namespace in other branches
  1. 6.2 patterns.module \patterns_load_string_yaml()

File

./patterns.module, line 1134
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_load_string_yaml($source) {

  // loading yaml from source doesn't preserve line breaks
  // so we need to save it as a file first
  $path = file_directory_temp() . '/import.yaml';
  file_save_data($source, $path, FILE_EXISTS_REPLACE);
  $pattern = patterns_load_yaml($path);
  unlink($path);
  return $pattern;
}