You are here

function patterns_paths in Patterns 6

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

return a list of paths that will be scanned for patterns

2 calls to patterns_paths()
patterns_get_patterns in ./patterns.module
patterns_help in ./patterns.module
Implementation of hook_help().

File

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

Code

function patterns_paths() {
  global $profile;
  if (!isset($profile)) {
    $profile = variable_get('install_profile', 'default');
  }

  // array of all the paths where we should look for patterns
  $patterns_paths = array(
    conf_path() . '/patterns',
    'profiles/' . $profile . '/patterns',
    'sites/all/patterns',
  );

  // allow any module to include patterns too
  foreach (module_invoke_all('patterns_directory') as $path) {
    if (is_dir($path)) {
      $patterns_paths[] = $path . '/patterns';
    }
  }

  // also prepend files folder if it's valid
  $path = file_create_path(variable_get('patterns_save_xml', 'patterns'));
  if (file_check_directory($path)) {
    array_unshift($patterns_paths, $path);
  }
  return $patterns_paths;
}