function _patterns_scan_validate_patternscan in Patterns 7.2
Same name and namespace in other branches
- 7 includes/parser/scan.inc \_patterns_scan_validate_patternscan()
Analyze the result of a call to patterns_scan_pattern, and check whether the pattern was valid.
Parameters
array $patternscan : The analysis array obtained from patterns_scan_pattern.
bool $include (optional): If TRUE, it means that the pattern to scan is an include, and a laxer scan is performed. E.g. Info section can be missing, actions can be outside of a section. Default FALSE.
integer $level (optional) : The level of of the analysis. Defaults PATTERNS_VALIDATE_ALL
$display_errors (optional): If TRUE, errors are displayed with drupal_set_message. Defaults FALSE
Return value
bool TRUE if valid, FALSE otherwise.
6 calls to _patterns_scan_validate_patternscan()
- patterns_enable_pattern in ./
patterns.module - Form constructor for the Patterns enabling form.
- patterns_import_validate in includes/
forms/ import.inc - patterns_parser_get_pattern_details in includes/
parser/ parser.inc - Returns an array with detailed information about the pattern(s) referenced in the pattern files (included).
- patterns_validate_pattern in includes/
parser/ parser.inc - Check if pattern array or content from a file is valid.
- patterns_validate_service in includes/
parser/ parser.inc - Callback of the url patterns/validate.
File
- includes/
parser/ scan.inc, line 322 - Helping functions for the parser.
Code
function _patterns_scan_validate_patternscan($patternscan, $include = FALSE, $level = PATTERNS_VALIDATE_ALL, $display_errors = FALSE) {
$analysis = _patterns_scan_analyze_patternscan($patternscan, $include, $level);
if (empty($analysis)) {
return TRUE;
}
if ($display_errors) {
drupal_set_message(t('Error(s) and/or warning(s) while processing pattern:') . '<ul><li>' . implode('</li><li>', $analysis) . '</li></ul>', 'error');
}
return FALSE;
}