/** * Preprocess variables for page.tpl.php * default variales for page.tpl.php: * $logo, $front_page, $site_name, $site_slogan, $messages * $title_prefix, $title_suffix, $tabs, $action_links * $feed_icons, $breadcrumb */ function water_preprocess_page(&$vars) { if (isset($vars['node'])) { // If the node type is "blog_madness" the template suggestion will be "page--blog-madness.tpl.php". $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type; if ($vars['node']->type == 'deprecated_organization') { //var_dump($vars['node']); //$vars['organization_geolocation'] = array($vars['node']->field_latitude['und']['0']['value'], $vars['node']->field_longitude['und']['0']['value']); /* * LOAD GMAPS MODULE */ //add html element 'organization-gmap-canvas' in template file that will hold Google map //Load gmap3_tools.inc file module_load_include('inc', 'gmap3_tools'); //all gmap3_tools_add_map() function from API file with appropriate map configuratio array gmap3_tools_add_map(array('mapId' => 'organization-gmap-canvas', 'mapOptions' => array('centerX' => -34.397, 'centerY' => 150.644, 'zoom' => 12), 'markers' => array(gmap3_tools_create_marker(-1, -1, 'Home', 'Home')), 'geocodeAddress' => $vars['node']->field_city['und']['0']['taxonomy_term']->name, 'gmap3ToolsOptions' => array('defaultMarkersPosition' => GMAP3_TOOLS_DEFAULT_MARKERS_POSITION_CENTER))); } //create a variable to hold rich title field added to specific content types $view = node_view($vars['node']); $vars['rich_title'] = render($view['field_rich_title']); } //var_dump($vars); //var_export($vars); //var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); // $vars['contact_form'] = drupal_render(drupal_get_form('contact_site_form')); }
/* * marker text */ $text = $row['field_first_name'] . $inlineDelim . $row['title'] . $paragraphDelim . $affiliationInfo . $paragraphDelim . implode($paragraphDelim, $groups); /* * get icon from taxonomy term */ $term_tree = taxonomy_get_term_by_name($groups[0]); foreach ($term_tree as $term) { //var_dump($term); $icon = !empty($term) && !empty($term->field_marker_url) ? $term->field_marker_url['und']['0']['value'] : 'marker.png'; } /* * markers options: https://developers.google.com/maps/documentation/javascript/reference?csw=1#MarkerOptions * markers icons: http://mabp.kiev.ua/2010/01/12/google-map-markers/ */ $icon_url = file_create_url(variable_get('file_public_path', conf_path() . '/files') . '/gmap3_markers/' . $icon); $markers[] = gmap3_tools_create_marker($coordinates[0], $coordinates[1], '', $text, array('icon' => $icon_url, 'group' => $groups[0])); /* * legend info */ if (empty($legendInfo[$groups[0]])) { $legendInfo[$groups[0]] = array('iconUrl' => $icon_url, 'text' => $groups[0]); } } } /* all gmap3_tools_add_map() function from API file with appropriate map configuration array, for more map options check https://developers.google.com/maps/documentation/javascript/reference?csw=1#MapOptions */ gmap3_tools_add_map(array('mapId' => 'organization-gmap-canvas', 'mapOptions' => array('centerX' => -34.397, 'centerY' => 150.644, 'zoom' => 2, 'scrollwheel' => false), 'legend' => array('header' => '', 'content' => $legendInfo), 'markers' => $markers, 'gmap3ToolsOptions' => array('defaultMarkersPosition' => GMAP3_TOOLS_DEFAULT_MARKERS_POSITION_CENTER)));