function patterns_validate_pattern in Patterns 6
Same name and namespace in other branches
- 6.2 patterns.module \patterns_validate_pattern()
- 7.2 includes/parser/parser.inc \patterns_validate_pattern()
- 7 includes/parser/parser.inc \patterns_validate_pattern()
Check if pattern array contains only allowed keys
@todo expand this function to include much more detailed validation
Parameters
$pattern: pattern array obtained by parsing pattern file
Return value
TRUE when only allowed array keys are found, FALSE otherwise
3 calls to patterns_validate_pattern()
- patterns_load_php in ./
patterns.module - Read and evaluate a php file to return a 'pattern'
- patterns_load_string_xml in ./
patterns.module - patterns_load_yaml in ./
patterns.module
File
- ./
patterns.module, line 1094 - Enables extremely simple adding/removing features to your site with minimal to no configuration
Code
function patterns_validate_pattern($pattern) {
if (empty($pattern)) {
return FALSE;
}
$allowed_keys = array(
'info',
'modules',
'actions',
);
$diff = array_diff(array_keys($pattern), $allowed_keys);
return empty($diff) ? TRUE : FALSE;
}