I have two location fields in the same node type: (1) a business' physical address and (2) countries the business services.
I'd like to theme these two location fields, specifically, moving the postcode to come after the country (not after the state/province) in (1), editing the map link to open in a new window in (1), and removing the map links altogether in (2).

The closest I've found to do this is overriding location.tpl.php, but this doesn't seem to differentiate between different locations in the same node (i.e. removing the map links from one location field removes them from all fields), and I can't seem to edit the map link at all (to put a 'target="_blank"' in there)...

Any assistance would be much appreciated!

Comments

Anonymous’s picture

Still looking for an answer to this if possible...

yesct’s picture

I guess the module would have to generate divs like:

div class location 
  div class location1 
  enddiv 
  div class location2 
  enddiv 
enddiv

someone is welcome to try to edit the code to make a patch that would accomplish this. ( http://drupal.org/patch/create ) be sure to use the most resent dev version.

are you thinking you would like to have a map link on some locations but not others? I wonder if the map divs are inside the location divs like:

div class location 
  div class location1 
    div class map
      div class map1
      enddiv
    enddiv
  enddiv 
  div class location2 
    div class map
      div class map2
     enddiv
    enddiv
  enddiv 
enddiv

the map issue sounds like a duplicate of: #172646: Add div class for map links

Also, tagging to help find related issues.

yesct’s picture

tagging.

rooby’s picture

Status: Active » Fixed

In the latest version the map link can be set to open in a new window on the settings page (admin/settings/location). Other than that the map link is not themable. A new issue would have to be opened if you wanted that.

The location template doesn't know where it is being printed so to do content type specific things in your tpl you will have to add that information using template_preprocess_location(&$variables). In this preprocessor you could add a context variable so that in your tpl you know where you are.
You could get the node type by checking the url for a node id and then getting the type for that node and saving it to a variable in the $variables array.
Then in the template you can check that variable.

pedrosp’s picture

My 2 cents:

Just add an Id at the top of "location.tpl.php" next to the infamous "location vcard" class.
You can then override your css.

example:

<div id="locationadandara" class="location vcard">
  <div class="adr">
    <?php if (!empty($name)): ?>
      <span class="fn"><?php print $name; ?></span>
    <?php endif; ?>

CSS:

/*  location */
#locationadandara {
background-color: green;
}

Status: Fixed » Closed (fixed)
Issue tags: -Location theming, -location theming map links, -location multiple locations

Automatically closed -- issue fixed for 2 weeks with no activity.