leaflet_more_maps_cartodb.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. diff --git a/leaflet_more_maps.module b/leaflet_more_maps.module
  2. index 308d1eb..fadf2cd 100644
  3. --- a/leaflet_more_maps.module
  4. +++ b/leaflet_more_maps.module
  5. @@ -555,6 +555,37 @@ function _leaflet_more_maps_assemble_default_map_info(array &$map_info, array $d
  6. ],
  7. ],
  8. ];
  9. +
  10. + // cartodb
  11. + $attr_cartodb = '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>';
  12. + $cartodb_names = [
  13. + 'light_all',
  14. + 'light_nolabels',
  15. + 'light_only_labels',
  16. + 'dark_all',
  17. + 'dark_nolabels',
  18. + 'dark_only_labels',
  19. + 'rastertiles/voyager',
  20. + 'rastertiles/voyager_nolabels',
  21. + 'rastertiles/voyager_only_labels',
  22. + 'rastertiles/voyager_labels_under'
  23. + ];
  24. + foreach ($cartodb_names as $cartodb_name) {
  25. + $code = mb_strtolower($cartodb_name);
  26. + $label = t('Cartodb @name', ['@name' => $cartodb_name]);
  27. + $url_template = "https://{s}.basemaps.cartocdn.com/$code/{z}/{x}/{y}{r}.png";
  28. + $map_info["cartodb-$code"] = [
  29. + 'label' => $label,
  30. + 'description' => $label,
  31. + 'settings' => $default_settings,
  32. + 'layers' => [
  33. + '' => [
  34. + 'urlTemplate' => $url_template,
  35. + 'options' => ['attribution' => $attr_cartodb],
  36. + ]
  37. + ]
  38. + ];
  39. + }
  40. }
  41. /**