You are here

function patterns_load_php in Patterns 6

Same name and namespace in other branches
  1. 6.2 patterns.module \patterns_load_php()

Read and evaluate a php file to return a 'pattern'


./patterns.module, line 1183
Enables extremely simple adding/removing features to your site with minimal to no configuration


function patterns_load_php($path, $local = TRUE) {
  if ($local && !file_exists($path)) {
    return FALSE;
  $pattern = array();
  @(include $path);

  // That should have declared a 'pattern' into current scope.
  if (!patterns_validate_pattern($pattern)) {
    trigger_error("Failed to evaluate a useful pattern from the input file {$path}. Pattern did not validate. May have been invalid syntax. ", E_USER_WARNING);
    return FALSE;
  return $pattern;