You are here

function fancy_file_delete_unmanaged_get_chosen_dirs in Fancy File Delete 7

Answer a list of chosen directories from which to delete unmanaged files from. Defaults to all directories if no choice was previously made.

Return value

mixed array

2 calls to fancy_file_delete_unmanaged_get_chosen_dirs()
FancyFileDeleteUnmanagedDirectoryFilter::value_form in views/inc/FancyFileDeleteUnmanagedDirectoryFilter.inc
Options form subform for setting options.
fancy_file_delete_unmanaged_update_view in ./fancy_file_delete.module
Updates the view and populates the unmanaged files table.

File

./fancy_file_delete.module, line 240

Code

function fancy_file_delete_unmanaged_get_chosen_dirs() {
  $all_dirs = fancy_file_delete_unmanaged_get_directories();
  $chosen_dirs = variable_get('fancy_file_delete_unmanaged_chosen_dirs', FALSE);
  if ($chosen_dirs === FALSE) {

    // Return only public on first pass for performance.
    // see issue: https://www.drupal.org/node/2637028
    return array(
      'public://',
    );
  }
  else {

    // Only include directories that currently exist.
    $chosen = array_intersect($all_dirs, $chosen_dirs);
    natsort($chosen);
    return array_values($chosen);
  }
}