/**
  * Build map from input array
  *
  */
 protected function build_map($map_element = array())
 {
     $map_mods = array();
     $data = array();
     // attach section map data if element turns out to be empty, otherwise return void.
     $e = !empty($map_element) ? $map_element : $this->map_data;
     if (empty($e)) {
         return;
     }
     $style = $e['map_style'];
     $size = $e['map_size'];
     $center = $e['map_center'];
     $zoom_level = $e['map_zoom_level'];
     $markers = $e['map_markers'];
     // Set map style.
     if (isset($style) && in_array($style, array('dots', 'network', 'route', true))) {
         $map_mods['style'] = $style;
     }
     // Set map size.
     if (isset($size) && in_array($size, array('wide', 'square', 'small', true))) {
         $map_mods['size'] = $size;
     }
     // Set map center.
     if (is_array($center) && array_key_exists('lat', $center) && array_key_exists('lng', $center)) {
         $map_mods['data']['center'] = $center['lat'] . ';' . $center['lng'];
     }
     // Set zoom level.
     if (isset($zoom_level)) {
         $map_mods['data']['zoom_level'] = $zoom_level;
     }
     if (isset($map_mods['data']['zoom_level'])) {
         $map = new SimpleMap($e, $this->element, $map_mods);
         $this->output .= $map->embed();
     }
 }
 /**
  * Publish collaboration map.
  *
  * @param string context Context
  * @return void if no participants are found
  */
 public function publish_collab_map($context = '')
 {
     $collab_map_caption = $this->controller->create_map_caption();
     $num_participants = count($this->participants);
     if ($num_participants <= 1) {
         return;
     }
     $input = array('map_style' => 'network', 'map_size' => 'wide', 'map_markers' => false, 'map_collaborations' => array(0 => $this->post_id), 'map_caption' => $collab_map_caption);
     $map = new SimpleMap($input, 'collaboration');
     if (!empty($map)) {
         $map->publish();
     }
 }