public static function RealisticDummyContentEnvironment::implementSortCandidateFiles in Realistic Dummy Content 8.2
Same name and namespace in other branches
- 7.2 api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::implementSortCandidateFiles()
- 3.x api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::implementSortCandidateFiles()
Given a list of candidate files, sort them by names and parts.
Parameters
array $candidate_files: An array keyed by filename which contains drupal file objects. See SortCandidateFiles().
array $extensions: (Default is NULL). If set, extensions to filter by. See SortCandidateFiles().
Return value
array A sorted array. See SortCandidateFiles().
Throws
\Exception
1 call to RealisticDummyContentEnvironment::implementSortCandidateFiles()
- RealisticDummyContentEnvironment::sortCandidateFiles in api/
src/ includes/ RealisticDummyContentEnvironment.php - Given a list of candidate files, sort them by names and parts.
File
- api/
src/ includes/ RealisticDummyContentEnvironment.php, line 260
Class
- RealisticDummyContentEnvironment
- The abstract base environment.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public static function implementSortCandidateFiles($candidate_files, $extensions = NULL) {
$return = array();
foreach ($candidate_files as $candidate_filename => $candidate_file) {
if (self::validCandidateFilename($candidate_filename, $extensions)) {
self::addFileToArray($return, $candidate_filename, $candidate_file);
}
}
// We expect the files to be sorted alphabetically, which is not the case on
// all systems.
ksort($return);
return $return;
}