You are here

public function MapThemerPluginManager::getMapThemersList in Geofield Map 8.2

Generate a by weight ordered Options array for all the MapThemers plugins.

Parameters

string $context: Context value to filter the MapThemers plugins with.

Return value

mixed[] An array of MapThemers plugins Options. Keys are plugin IDs.

File

src/MapThemerPluginManager.php, line 84

Class

MapThemerPluginManager
Provides a plugin manager for Geofield Map Themers.

Namespace

Drupal\geofield_map

Code

public function getMapThemersList($context = NULL) {
  $options = [];
  $map_themers_definitions = $this
    ->getDefinitions();
  uasort($map_themers_definitions, 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
  foreach ($map_themers_definitions as $k => $map_themer) {
    if (empty($context) || in_array($context, $map_themer['context'])) {

      /* @var \Drupal\Core\StringTranslation\TranslatableMarkup $map_themer_name */
      $map_themer_name = $map_themer['name'];
      $options[$k] = $map_themer_name
        ->render();
    }
  }
  return $options;
}