You are here

function patterns_parser_exists in Patterns 7

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

Checks wheter a parser is defined for a given format.

Parameters

mixed $format A string representing the format:

Return value

bool TRUE, if the parser is defined, FALSE otherwise.

8 calls to patterns_parser_exists()
PatternsTestCase::callbackOnDir in tests/patterns.test
Loads all the pattern files from a directory and executes a callback on each parsed pattern.
PatternsTestCase::runDir in tests/patterns.test
Scans a directory for patterns files, and executes them.
patterns_drush_get_file_format in ./patterns.drush.inc
patterns_import_validate in includes/forms/import.inc
patterns_io_get_format_from_file in includes/io/import.inc
Extracts and validates the pattern format from a file string

... See full list

File

includes/parser/parser.inc, line 106

Code

function patterns_parser_exists($format = PATTERNS_FORMAT_UNKNOWN, $reset = TRUE) {
  if (empty($format) || $format == PATTERNS_FORMAT_UNKNOWN) {
    return FALSE;
  }
  $patterns_formats = patterns_parser_build_formats_index($reset);
  if (!isset($patterns_formats[$format]) || empty($patterns_formats[$format])) {
    return FALSE;
  }
  return TRUE;
}