You are here

function farm_area_farm_map_view in farmOS 7

Implements hook_farm_map_view().

File

modules/farm/farm_area/farm_area.farm_map.inc, line 65
Farm Map hooks implemented by the Farm Area module.

Code

function farm_area_farm_map_view($name, $element) {

  // Add a farmOS map behavior that adds all area layers to the areas map.
  if ($name == 'farm_areas') {
    farm_map_add_behavior('popup');
    farm_map_add_behavior('areas', array(
      'zoom' => TRUE,
    ));
  }

  // Show "all areas" layer in geofield maps, and zoom to them if no WKT is set.
  if (in_array($name, array(
    'farm_map_geofield',
    'farm_map_geofield_widget',
  ))) {
    $zoom = empty($element['#wkt']) || $element['#wkt'] == 'GEOMETRYCOLLECTION EMPTY';
    farm_map_add_behavior('areas_combined', array(
      'zoom' => $zoom,
    ));
  }
}