You are here

public function UnmanagedFilesService::getChosenDirs in Fancy File Delete 2.0.x

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

Return value

mixed array

1 call to UnmanagedFilesService::getChosenDirs()
UnmanagedFilesService::updateView in src/UnmanagedFilesService.php
Updates the view and populates the unmanaged files table.

File

src/UnmanagedFilesService.php, line 154

Class

UnmanagedFilesService
Class UnmanagedFilesService.

Namespace

Drupal\fancy_file_delete

Code

public function getChosenDirs() {
  $all_dirs = $this
    ->getDirs();
  $chosen_dirs = $this->state
    ->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 [
      'public://',
    ];
  }

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