You are here

function patterns_export_to_file in Patterns 7.2

Same name and namespace in other branches
  1. 7 patterns_export/finalize.inc \patterns_export_to_file()

Exports a pattern as a donwlodable text file

Parameters

array $sections The sections of the pattern:

array $info The info section of the pattern:

array $modules The modules section of the pattern:

string $format The pattern format:

string $filename The final name of file :

1 call to patterns_export_to_file()
patterns_export_finalize_export in patterns_export/finalize.inc
Initializes the appropriate action to export a collection of patterns

File

patterns_export/finalize.inc, line 107

Code

function patterns_export_to_file($sections = array(), $info = array(), $modules = array(), $format, $filename) {
  $pattern = _patterns_export_merge_exported_patterns($sections, $info, $modules);
  $pattern = patterns_parser_dump($pattern, $format);

  // drush
  if (patterns_utils_is_cli()) {
    return file_put_contents($filename, $pattern);
  }
  else {
    patterns_download_file($pattern, $filename . '.' . $format);
  }
}