function patterns_api_add_section in Patterns 7.2
Same name and namespace in other branches
- 7 includes/api/api.inc \patterns_api_add_section()
Initializes an empty section in a pattern file.
Checks whether the section name is valid before adding it.
Parameters
mixed $section_name: A string representing the pattern name
array $pattern (optional): The associative array representing a pattern
Bool $ow (optional): If TRUE, an existing section with the same name will be overwritten. Defaults FALSE.
File
- includes/
api/ api.inc, line 99 - API for writing pattern files.
Code
function patterns_api_add_section($section_name = NULL, &$pattern = array(), $ow = FALSE) {
if (empty($section_name)) {
return FALSE;
}
if (patterns_api_is_reserved_word($section_name)) {
return FALSE;
}
if (isset($pattern[$section_name]) && !$ow) {
return FALSE;
}
$pattern[$section_name] = array();
return $pattern;
}