You are here

public function MapFeatureManager::getMapFeaturesByMapType in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 src/MapFeatureManager.php \Drupal\geolocation\MapFeatureManager::getMapFeaturesByMapType()

Return MapFeature by ID.

Parameters

string $type: Map type.

Return value

array[] Map feature list.

File

src/MapFeatureManager.php, line 69

Class

MapFeatureManager
Search plugin manager.

Namespace

Drupal\geolocation

Code

public function getMapFeaturesByMapType($type) {
  $definitions = $this
    ->getDefinitions();
  $list = [];
  try {
    foreach ($definitions as $id => $definition) {
      if ($definition['type'] == $type || $definition['type'] == 'all') {
        $list[$id] = $definition;
      }
    }
  } catch (\Exception $e) {
    return [];
  }
  uasort($list, [
    self::class,
    'sortByName',
  ]);
  return $list;
}