You are here

function patterns_parser_get_pattern_details in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/parser/parser.inc \patterns_parser_get_pattern_details()

Returns an array with detailed information about the pattern(s) referenced in the pattern files (included).

Parameters

stdClass $pattern Pattern object as loaded by patterns_get_pattern().:

mixed $validate_level The level of validation required:

Return value

array $details array('pid1' => $details, 'pid2' => $details, ...), FALSE if there were errors (in which case the errors will be displayed).

1 call to patterns_parser_get_pattern_details()
patterns_start_engine in ./patterns.module
The beginning of the whole Patterns logic. Starts the execution in 'batch' mode (default) or 'php' mode, which makes things easier for debugging.

File

includes/parser/parser.inc, line 347

Code

function patterns_parser_get_pattern_details($pattern, $validate_level = PATTERNS_VALIDATE_ALL) {
  $scan = patterns_scan_pattern($pattern->pattern);

  // This will NOT display errors
  if (!_patterns_scan_validate_patternscan($scan, FALSE, $validate_level)) {
    return FALSE;
  }
  $details = array();
  $details['info'] = $pattern->pattern['info'];
  $details['sections'] = array_intersect_key($pattern->pattern, $scan['other_sections']);
  $details['modules'] = $scan['modules'] > 0 ? $pattern->pattern['modules'] : array();
  return array(
    $pattern->pid => $details,
  );

  // TODO: only one pattern
}