public function LeafletGeoJSONBean::view in Leaflet GeoJSON 7
Same name and namespace in other branches
- 7.2 modules/leaflet_geojson_bean/plugins/bean/leaflet_geojson_bean.inc \LeafletGeoJSONBean::view()
Displays the bean.
Overrides BeanPlugin::view
File
- modules/
leaflet_geojson_bean/ plugins/ bean/ leaflet_geojson_bean.inc, line 121 - Leaflet GeoJSON bean plugin.
Class
- LeafletGeoJSONBean
- @file Leaflet GeoJSON bean plugin.
Code
public function view($bean, $content, $view_mode = 'default', $langcode = NULL) {
// Prepare leaflet map settings.
$map = leaflet_map_get_info($bean->settings['map']);
$height = $bean->settings['height'];
// Prepare source and fetch json.
$source_info = leaflet_geojson_source_get_info($bean->settings['source']);
$features = array();
$context = array(
'map' => &$map,
'source_info' => &$source_info,
'bean' => &$bean,
);
drupal_alter('leaflet_geojson_bean_view_features', $features, $context);
$content['map'] = array(
'#markup' => leaflet_render_map($map, $features, $height . 'px'),
);
return $content;
}