Display asset cluster map in the main sensors page.
This commit is contained in:
parent
cd5751dc53
commit
04691052ac
|
@ -445,3 +445,30 @@ function farm_sensor_farm_sensor_type_info() {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_page_build().
|
||||
*/
|
||||
function farm_sensor_page_build(&$page) {
|
||||
|
||||
// If this is the sensors page, display the sensor asset map.
|
||||
$current_path = current_path();
|
||||
$map_paths = array(
|
||||
'farm/sensors',
|
||||
'farm/sensors/list',
|
||||
);
|
||||
if (in_array($current_path, $map_paths)) {
|
||||
|
||||
// Load the assets map.
|
||||
$map = \Drupal\openlayers\Openlayers::load('Map', 'farm_assets_sensor');
|
||||
|
||||
// Build the map and add it to the page content.
|
||||
$page['content']['farm_assets_sensor'] = $map->build();
|
||||
|
||||
// Set the weight to -100 so that it appears on top.
|
||||
$page['content']['farm_assets_sensor']['#weight'] = -100;
|
||||
|
||||
// Set the content region #sorted flag to FALSE so that it resorts.
|
||||
$page['content']['#sorted'] = FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue