public static function Imce::folderInConf in IMCE 8
Same name and namespace in other branches
- 8.2 src/Imce.php \Drupal\imce\Imce::folderInConf()
Returns predefined/inherited configuration.
Returns predefined/inherited configuration of a folder path in a profile conf.
1 call to Imce::folderInConf()
- ImceFM::checkFolder in src/
ImceFM.php - Checks if the user provided folder path is accessible.
File
- src/
Imce.php, line 166
Class
- Imce
- Imce container class for helper methods.
Namespace
Drupal\imceCode
public static function folderInConf($path, array $conf) {
// Predefined.
if (isset($conf['folders'][$path])) {
return $conf['folders'][$path];
}
// Inherited.
if (!empty($conf['folders']) && static::regularPath($path) && is_dir(static::joinPaths($conf['root_uri'], $path))) {
foreach ($conf['folders'] as $folder_path => $folder_conf) {
$is_root = $folder_path === '.';
if ($is_root || strpos($path . '/', $folder_path . '/') === 0) {
if (static::permissionInFolderConf('browse_subfolders', $folder_conf)) {
// Validate the rest of the path.
if ($filter = static::nameFilterInConf($conf)) {
$rest = $is_root ? $path : substr($path, strlen($folder_path) + 1);
foreach (explode('/', $rest) as $name) {
if (preg_match($filter, $name)) {
return;
}
}
}
return $folder_conf + [
'inherited' => TRUE,
];
}
}
}
}
}