Drupal 5.1 with cck, location module

I cannot print the fields used with the location module (street, postal code, city, country)! I'm ableto print cck fields, but I'm not interessted to create new fields (street, city, poststal code) which should be created with the location module. Am I getting this wrong - any clues?

My user_edit.tpl.php has this:

Address information
print drupal_render($form['street']);
print drupal_render($form['postal_code']);
print drupal_render($form['city']);
print drupal_render($form['country']);

Using print_r($node); I can see the fields names and they seem correct. But in some array I think. I did not get this line to work as shown in the tutorial: print ""; print_r(array_values($form));print "";

Br,
Dan

Comments

greenskin’s picture

If you have the Devel module installed enter the following in your tpl:
dprint_r($form);

Else, if you don't have Devel try:
print "

";
print_r($form);
print "

";

That will give you the array structure so you can supply the appropriate keys to get the values you need.

greenskin’s picture

Sorry, I should have used the php tags to make that easier to read. I try again...

If Devel...

dprint_r($form);

Else...

print "<pre>";
print_r($form);
print "</pre>";
greenskin’s picture

LOL, one last post hopefully. I keep submitting too soon.

My examples use $form. That should be $node for in the tpl.php.

Hope that helps. Also, if anyone knows how to edit comments here, I'd appreciate it if you let me know. :P

yesct’s picture

Title: Strugling to theme location module fields » Strugling to theme location module fields edit form
Issue tags: +location theme edit form

I think this is asking about how to theme the form. If someone could verify that is the request, and maybe point to another issue which addresses the solution, please do.

yesct’s picture

yesct’s picture

Issue tags: +Location theming

there are some other location theming issues, adding a tag.

rc2020’s picture

On Drupal 6 version, line 1686, there's this code:

  // Tidy up the form in the single location case.
  if ($numforms == 1) {
    $form[0]['#title'] = t('Location');
    // If the user had configured the form for a single location, inherit
    // the collapsible / collapsed settings.
    $form[0]['#collapsible'] = $form['#collapsible'];
    $form[0]['#collapsed'] = $form['#collapsed'];
    //**HACK**//
    $form[0]['#prefix'] = '<div class="location_wrapper">';
    $form[0]['#suffix'] = '</div>';
  }

After the //**HACK**// I added this code to get a wrapper around the location box, allowing for extra theming. You can use this class (or make it ID) to force lengths and colors of form items. There are individual form items which you can add these attributes to. The http://api.drupal.org/api/file/developer/topics/forms_api.html/5 form helps out with alot of the things you can do with forms.

yesct’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
Berliner-dupe’s picture

Status: Closed (fixed) » Active

@corona ronin and all

It is possible to theme every field alone in Drupal 6? [city], [street], [postal code]?

I will add a jQuery-Plugin to the city-field but i dont know how i can make this.

Has anyone an idea?

Thank you and Regards
Matthias

Berliner-dupe’s picture

Status: Active » Closed (won't fix)

I make a new Issue!

http://drupal.org/node/906670