function media_browser_plus_construct_dir_path in Media Browser Plus 7
Same name and namespace in other branches
- 7.3 media_browser_plus.module \media_browser_plus_construct_dir_path()
- 7.2 media_browser_plus.module \media_browser_plus_construct_dir_path()
Construct the path of a media_folder term.
Parameters
$term object containing term id and term name:
5 calls to media_browser_plus_construct_dir_path()
- media_browser_plus_folder_delete_submit in includes/
media_browser_plus.folders.inc - @todo Document what this function is does.
- media_browser_plus_folder_list_submit in includes/
media_browser_plus.folders.inc - @todo Document what this function is does.
- media_browser_plus_folder_save_folder in includes/
media_browser_plus.folders.inc - @todo Document what this function is does.
- media_browser_plus_folder_update_file_locations_batch in includes/
media_browser_plus.folders.inc - Batch function that updates all media URIs inside the given folders.
- media_browser_plus_move_file in ./
media_browser_plus.module - Moves and saves permanently a media file.
File
- ./
media_browser_plus.module, line 2170 - Adds fields to the media browser forms for better UX
Code
function media_browser_plus_construct_dir_path($term) {
$file_default_scheme = variable_get('file_default_scheme', 'public') . ':/';
if ($term) {
$parents = array_reverse(taxonomy_get_parents_all($term->tid));
$path = $file_default_scheme . '/';
if (is_array($parents) && !empty($parents)) {
foreach ($parents as $parent) {
$path .= $parent->name . '/';
}
}
$path = str_replace('Media Root', variable_get('media_root_folder', 'media'), $path);
$dir_path = rtrim($path, '/');
}
return isset($dir_path) ? $dir_path : $file_default_scheme;
}