protected function MarkerIconService::setMarkersFilesList in Geofield Map 8.2
Generates alphabetically ordered Markers Files/Icons list.
Return value
array The Markers Files/Icons list.
1 call to MarkerIconService::setMarkersFilesList()
- MarkerIconService::__construct in src/
Services/ MarkerIconService.php - Constructor of the Icon Managed File Service.
File
- src/
Services/ MarkerIconService.php, line 160
Class
- MarkerIconService
- Provides an Icon Managed File Service.
Namespace
Drupal\geofield_map\ServicesCode
protected function setMarkersFilesList() {
$markers_files_list = [];
$regex = '/\\.(' . preg_replace('/ +/', '|', preg_quote($this->allowedExtension)) . ')$/i';
$security = $this->geofieldMapSettings
->get('theming.markers_location.security');
$rel_path = $this->geofieldMapSettings
->get('theming.markers_location.rel_path');
try {
$files = $this->fileSystem
->scanDirectory($security . $rel_path, $regex);
$additional_markers_location = $this->geofieldMapSettings
->get('theming.additional_markers_location');
if (!empty($additional_markers_location)) {
$additional_files = $this->fileSystem
->scanDirectory($additional_markers_location, $regex);
$files = array_merge($files, $additional_files);
}
ksort($files, SORT_STRING);
foreach ($files as $k => $file) {
$markers_files_list[$k] = $file->filename;
}
} catch (NotRegularDirectoryException $e) {
watchdog_exception('geofield map set markers fiel list', $e);
}
return $markers_files_list;
}