function patterns_path_get_patterns_dirs in Patterns 7
Same name and namespace in other branches
- 7.2 includes/path.inc \patterns_path_get_patterns_dirs()
Return a list of paths that will be scanned for pattern files.
3 calls to patterns_path_get_patterns_dirs()
- drush_patterns_paths in ./
patterns.drush.inc - List of patterns path command callback.
- patterns_info_directories in includes/
forms/ info.inc - Displays a summary of available Patterns directories
- patterns_io_scan_directories in includes/
io/ io.inc - Scan directories looking for patterns files.
File
- includes/
path.inc, line 25
Code
function patterns_path_get_patterns_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 ($path as $p) {
if (is_dir($p) && is_readable($p)) {
$patterns_paths[] = $p;
}
}
}
return $patterns_paths;
}