You are here

function patterns_path_get_components_dirs in Patterns 7.2

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

Return a list of paths that will be scanned for pattern files.

File

includes/path.inc, line 55

Code

function patterns_path_get_components_dirs() {
  $patterns_paths = array(
    patterns_path_get_files_dir(),
    // must be first, in order not lose changes
    variable_get('patterns_save_file', 'sites/all/patterns/'),
    drupal_get_path('module', 'patterns') . '/patterns/',
  );
  $profile = variable_get('install_profile', 'default');
  if (isset($profile)) {
    $patterns_paths[] = 'profiles/' . $profile . '/patterns';
  }

  // Allow any module to include patterns too.
  foreach (module_invoke_all('patterns_directory') as $path) {
    $path = is_array($path) ? $path : array(
      $path,
    );
    foreach ($paths as $p) {
      if (is_dir($p) && is_readable($p)) {
        $patterns_paths[] = $p;
      }
    }
  }
  return $patterns_paths;
}