function patterns_io_load_pattern_from_file in Patterns 7
Same name and namespace in other branches
- 7.2 includes/io/io.inc \patterns_io_load_pattern_from_file()
Creates a pattern object from a file
The returned object is as if the pattern would be loaded from the database with patterns_get_pattern()
Parameters
string $file: The path to the file containing the pattern
string $format Optional.: A valid pattern format
Return value
stdClass $pattern The pattern object.
1 call to patterns_io_load_pattern_from_file()
File
- includes/
io/ io.inc, line 605 - Functions related to input/output operations.
Code
function patterns_io_load_pattern_from_file($file, $format = PATTERNS_FORMAT_UNKNOWN) {
$pattern = array();
$content = patterns_parser_load($file, $format);
if (!$content) {
return FALSE;
}
$pattern['pattern'] = $content;
$pattern = patterns_get_pattern_obj($pattern);
return $pattern;
}