I couldn't think of a better title, but from line 388 of the location_cck.module, you find:

...
      $location = array(
        'hide' => array_keys(array_filter($item['location_settings']['display']['hide'])),
        'location' => location_load_location($item['lid']),
      );

      // @@@ This is rather silly, but I can't think of anything better at the moment.
      template_preprocess_location($location);
...

The problem is that $item does not contain the 'location_settings' element, thus there is no way to know which fields are set to be hidden. I have no idea how to fix this, but this also relates to another issue http://drupal.org/node/373465.

Comments

yesct’s picture

pcambra’s picture

I think that this has something to do with these coments in the code of location_cck module:

 // We can't trust that CCK is giving us the right information.
      // It can't tell us whether $items is defaults or multistep values.
      // Location *needs* the defaults to match the initial field values,
      // so we re-calculate the defaults here and stash them into the settings.
      // @@@ There is still a bug here!
      // If you go back and edit something, and you hadn't set a location the
      // first time, CCK fails to set up the defaults properly!
      // I'm just going to leave it like that for now, because I don't know how
      // to work around it.

When you don't fill anything in the location info, the $object that is passed to the token values is almost empty, and doesn't contain the ['location_settings']['display'] property required for solving this issue.

I am getting the errors related in the #373465: Array errors in location_cck module issue when including location fields with Content Profile as non-required in the registration form in my site.

Anyone can give an advice on this?

Thanks!

drew reece’s picture

Anyone can give an advice on this?

Try the patch in #60

bdragon’s picture

Status: Active » Fixed

Marking this fixed.

I now think that there's no need to bother with hidden when working with tokens anyway.

Back in July 2009, I committed a change to just pass an array() and then forgot to update this issue.

Status: Fixed » Closed (fixed)

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