Skip to content

Commit

Permalink
Merge pull request #239 from localgovdrupal/fix/2.x/229-empty-views-map
Browse files Browse the repository at this point in the history
Add value to map to use in template when there are no features.
  • Loading branch information
finnlewis committed Oct 10, 2022
2 parents 97abb99 + 0edd3dc commit 96ab677
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions localgov_directories.module
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,13 @@ function localgov_directories_search_api_index_items_alter(IndexInterface $index
}
}
}

/**
* Implements hook_leaflet_map_view_style_alter().
*/
function localgov_directories_leaflet_map_view_style_alter(&$js_settings, $leaflet_map) {
// Add a value to the map if there are no features.
// https://github.com/localgovdrupal/localgov_directories/issues/229#issuecomment-1271418506
// This can be used in template if needed.
$js_settings['map']['is_empty'] = empty($js_settings['features']);
}

0 comments on commit 96ab677

Please sign in to comment.