i've been making heavy use of the location.module for a new 4.6 site i'm building. i love it. one slightly annoying problem i've encountered is that there seems to be no way to control the weight of the location box. it always appears at the very bottom (weight 20 or something) of any given node. for various reasons, i've defined a flexinode called "place" that i use for all my locations. unfortunately, any additional fields i add to this flexinode (note, URL, phone number, etc) always appear before the location itself, no matter how heavy or light i make them. obviously, i'd like the location info to be the first thing you see when viewing a "place". am i missing something, or is there really no way to control this? all other fields in a flexinode have their own weight. this seems like a natural thing for location.module to provide.
if i have a chance, i'll take a stab at a patch for this and submit it. in the meantime, i'm curious if other people:
- know of a way to accomplish this given the current 4.6 codebase
- if not, think this would be a valuable addition to location.module
thanks!
-derek
Comment | File | Size | Author |
---|---|---|---|
#26 | Picture 1.JPG | 123.31 KB | lyricnz |
#25 | Display of 6.x-3.0-rc2 configuration page | 59.29 KB | rootwork |
#20 | manage fields.png | 41.57 KB | anthonym |
#20 | content display.png | 29.51 KB | anthonym |
#5 | location_8.patch | 3.85 KB | ankur |
Comments
Comment #1
KarenS CreditAttribution: KarenS commented+1 on this idea, I needed it, too. I found a way to do it in 4.7 but am not sure it can be done in 4.6, at least I can't figure out how. It looks to me like 4.6 doesn't use "weights" for form elements, but 4.7 does. In the absence of some sort of weight, things end up in the order they are processed or the order in which various modules touched them.
Anyway, if anyone else is interested in this feature for 4.7 I'd be glad to provide my changes. While I was at it I added an option to say whether or not to display the form as a collapsible fieldset and to select whether or not to default it to the collapsed state. These setup options all get displayed in the same box where you enable various node types for locative features.
Comment #2
dwwyes, it seems like the forms API in 4.7 will mostly solve this problem. i'm moving this issue's version from 4.6 -> cvs. if you've got patches to location.module that add the weight, collapsable fields, etc, i think you should definitely post them here, and we should get them into the 4.7 location asap. thanks!
-derek
Comment #3
KarenS CreditAttribution: KarenS commentedHere's a patch. It's the first time I've tried creating a patch so hopefully I got it right :-)
Also, just to be clear, this will change the placement of the location box in input forms (when adding or editing a node) but won't have any affect on the display when viewing the record.
Comment #4
KarenS CreditAttribution: KarenS commentedOops -- slight mistake. The weight was supposed to default to 0. Here is an updated patch.
Comment #5
ankur CreditAttribution: ankur commentedThank you KarenS,
Committed a slightly altered version of the previous patch. I changed it a little so that the default values for collapsible and collapsed are true. I also changed around the printing of the lat/lon message when a user has permissions to submit for a lat/lon. A copy of the resulting patch is attached.
Will leave this issue open for now, however, because the issue was originally about changing the weight of locations for node views. I know that this isn't as possible for 4.6, but cannot confirm the same for 4.7. Will leave the issue open until we can make sure whether or not display weights can be altered.
-Ankur
Comment #6
ankur CreditAttribution: ankur commentedso, does anyone have any idea about whether it is possible to control the weight of a location in a node view for 4.7?
If not, I'll have to close this issue.
I haven't mentioned in this issue yet, but if you turn off the display of locations in admin/settings/location (just the display), it is possible to decide how locations get displayed w/ your own theme (at least in phptemplate, not sure about other theme engines). The node object that is passed has the entire location at $node->location after you set $node w/ a call to node_load(). This generally happens in the module code, not the theme code, but is available for the theme code to use after the it has been loaded by core/module code.
This means that, not only can you control the CSS of the location that is output, but you can also control the how and where actual HTML gets output within the node view (or a user view if you're trying to theme it to a different location).
-Ankur
Comment #7
geodaniel CreditAttribution: geodaniel commentedThis is also relevant for 5.x (current HEAD) except now the location information box is at the top of the page instead of at the bottom when viewing nodes.
Comment #8
jiangxijay CreditAttribution: jiangxijay commentedI wish to have the location fields appear at the bottom of node content, too, but the description of what to add via phptemplate theming is beyond me ;)
Has anyone else resolved this?
Comment #9
manerhabe CreditAttribution: manerhabe commentedI also would like to find a way to move the location information below the body of the node if possible without hacking some PHP. :)
Comment #10
rtdean93 CreditAttribution: rtdean93 commentedI too would like to move the location to the bottom of the node view.
Comment #11
scottrigbysubscribe
Comment #12
manerhabe CreditAttribution: manerhabe commentedStrange... when I added a text box field with CCK to my event content type (which I have the events & location modules enabled for), the location box mysteriously moved to the bottom. If I goto Manage fields in Content types, it lists the location box with a weight of 9. However, if I delete the text box field, the location box goes back up top.
Comment #13
scottrigbymy solution for now is to print the locative information when and where I want using my node-(content-type).tpl.php
I'm not great at this -- code is extremely messy (so if there's a better way to do it - pleas let me know!). But it's working for me, and it seems others are having trouble.
So in case my code (or responses by others who can better advise how to write this) could be helpful to someone else, here it is:
Comment #14
bdragon CreditAttribution: bdragon commented(marking master)
(http://drupal.org/node/180035 marked duplicate)
(http://drupal.org/node/171111 marked duplicate)
There are two issues here.
First of all, the location fieldset needs to have a weight, and there needs to be an easy way to configure it.
Second, location needs to use the $node->content array (Note: The latest DRUPAL-5 currently does this, I am not sure if any actual release incorporates this change though)
Comment #15
bdragon CreditAttribution: bdragon commented(Generalizing topic)
(http://drupal.org/node/153891 marked duplicate (Issue has possibly relevant patch))
(http://drupal.org/node/155439 marked duplicate)
(http://drupal.org/node/137820 marked duplicate)
(http://drupal.org/node/194900 marked duplicate)
This also affects profiles.
Comment #16
bdragon CreditAttribution: bdragon commentedDuplicates marked:
http://drupal.org/node/146161 (patch)
http://drupal.org/node/116476
Comment #17
crocodyl CreditAttribution: crocodyl commentedI am not sure what the solution is. Should I install a patch? Anyone know which one is best? Also, does anyone know where a set of instructions on how to install a patch is?
Comment #18
chlobe CreditAttribution: chlobe commentedsubscribing
Comment #19
nicholasThompsonCrocodyl: http://drupal.org/patch
Comment #20
anthonym CreditAttribution: anthonym commentedI've been having trouble with the position of the location info in my created content type for a while now. Just installed the latest HEAD release, hoping this might make things better, but I'm still getting the same results. I have the weight set correctly in the content type>edit tab (i.e. highest number = lowest position, but the location info is not behaving as expected. Instead of appearing last as defined, the location info is appearing second. Screenshots below. Where should I look to troubleshoot this?
Comment #21
anthonym CreditAttribution: anthonym commentedChanging category to bug report since this doesn't appear to be working correctly, at least for me.
Comment #22
mcurry CreditAttribution: mcurry commentedsubscribing.
I just had to do a hand-patch to fix this in 5.x-2.7. Is there a formal patch for 5.x-2.7?
Comment #23
bdragon CreditAttribution: bdragon commentedWontfix for 2.7, 3.x allows setting weight in the configuration.
Comment #24
dwwCool, thanks. ;) Shouldn't we call this "fixed" in 5.x-3.x-dev then? It's your queue, so I leave it up to you, but I personally prefer "fixed" when I actually fix something.
Comment #25
rootworkSo...I'm using the 3.x RC2 version in D6, and I don't see anything on the configuration pages to allow for setting weight. Is there something I'm missing?
I don't know if this applies to the D5 version as well, but I assume both 3.x versions would have the same configuration screens.
Comment #26
lyricnz CreditAttribution: lyricnz commentedThis configuration is in each of the places where you enable Location module, not in the Location settings (this is so you can configure it different in different places).
Eg: when editing the content-type, or the user-settings. See attachment for example of Story content type.
Comment #27
YesCT CreditAttribution: YesCT commentedmarked #319992: Location fieldset weight issue in node submission form as a duplicate of this issue