Closed (fixed)
Project:
Location
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Feb 2011 at 12:37 UTC
Updated:
24 Sep 2014 at 17:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rooby commentedThis appears to still be happening on node locations as well as cck locations.
Comment #2
dgastudio commentedsame here
Comment #3
ankur commentedLooks like the code that builds the form array in location.module is trying to pass the location array in as the #value attribute for a fieldset.
This patch should do it.
Comment #4
supportPIC commentedHi,
If I unset #value I got an error when saving, as if the element fields are empty.
I don't know if it is linked to this, but it seems the theme_location_element function is not called on form creation.
I am using the location_node module. Is it best to use it or the location_cck module ?
Comment #5
rooby commentedThanks for the patch.
Committed with the addition of a comment to explain what is going on with the unset().
http://drupal.org/cvs?commit=502310
Comment #6
rooby commentedRolled back the previous commit as it introduced a worse problem - #1067890: Location field is required.
http://drupal.org/cvs?commit=503648
Comment #7
enkara commentedSubscribing
Comment #8
arcaneadam commentedThis has to do with the function theme_fieldset specifically the following lines
Because we add the fieldset element to the location the default theme implementation of this tries to output the $element['#value'] which in locations case is an array. I think this can be bypassed using some theming alter and #pre_render magic, but I'm not 100% yet. I'm going to try some things then post my findings and hopefully a solution.
Comment #9
arcaneadam commentedI believe I have a solution. I've added a #pre_render and #post_render function to the $element that moves the $element['#value'] prior to the fieldset rendering it and returns it to it's rightful place afterwards to make sure the form validates correctly. patch attached
Comment #10
arcaneadam commentedWhoops heres the patch
Comment #11
altrugon commentedSubscribe
Comment #12
TheCrow commentedi solved this issue just substituting on location.module (function _location_process_location()) the row:
with the following:
Comment #13
mrgoltra commentedSubscribing
Comment #14
bryancasler commentedWhich solution should I be using #10 or #12?
Comment #15
tbenice commentedsubscribing. thanks for working on this!
Comment #16
adaddinsane#12 is the more elegant solution - but it doesn't work for me.
#10 works.
Comment #17
arcaneadam commented#12 isn't really a solution since it doesn't fix the problem at hand - the theme_fieldset functions handling of arrays in the #value key. Changing a + operator to array_merge doesn't change anything, they essentially work the same in this function since there are not any numbered keys to redo (look at example #3 on the PHP array_merge page)
I know my solution in #10 involves some work around but it involves the least amount of rewriting of module code, which is what I have time for right now.
Comment #18
bryancasler commentedarcaneadam, I can't get your patch in #10 to apply smoothly. I have the dev, but I don't see anything like this "function location_unimplemented_form" in location.module
I went ahead and put the "location_pre_render" at the bottom of location.module, that did work.
Comment #19
rlangille commentedI was able to successfully apply the patch in #10 to 7.x-3.x-dev on a vanilla install, and it worked like a charm. It may not be the ideal solution, but it does work.
Comment #20
rooby commentedI haven't had a chance to fully go over this but thanks for the patch.
Here is a cleaner version for latest dev.
One thing I'm not sure about without a little more investigation is in the post render function $element is being taken by reference and modified, which is not what post_render is meant for. Generally post_render is to modify the returned content variable.
Will look into it further.
Comment #21
joelstein commentedThe patch in #20 works for me.
Comment #22
ankur commentedHere's another way to approach the problem.
Basically, we want to use the default location to populate the individual form elements that comprise a location. The problem we're having, however, is that the form API sets the #value attribute to be that of #default_value, our array of default values.
We want to tell the form API not to try to render this value. I noticed that custom images for buttons/submits pass a '#has_garbage_value' attribute to get around this problem. The attached patch does something similar.
Comment #23
joelstein commentedI'm not sure what #22 is doing, but it didn't remove the word "Array" from the bottom of the node form. #20 does, though.
Comment #24
ankur commented@joelstein in #23,
Looks like you are using location_cck, for which my patch did not account.
The attached updated patch handles both location.module location forms and location_cck.module location forms.
Comment #25
joelstein commented@ankur: Yep, and your updated patch fixed it. Thanks!
Comment #26
shiraz dindarcool, is this gonna get rolled into dev soon?
Comment #27
rooby commentedI also have couple of ideas for solutions that are a little less hacky but might not work out, so i'd like to test them first and if they work out I'll post them here.
If not we can go with the current solution.
I should be all done with that in the next couple of days though.
Comment #28
dboulet commentedPatch in #24 seems to work, thanks.
Comment #29
Jerome F commentedThe patch in #24 removes the "array" for me too.
I'm following rooby's next step as well.
EDIT: sorry I should have named it location-1056148-29.patch
Comment #30
rdlang commentedWhen i did this on the latest tar in the downloads section, it dit work. After downloading the latest tree and putting that on my server, reapplying the patch in #24 did NOT remove the word array. Cleared al caches, but it's still there. Not sure if it is me or something in the tree changed
Comment #31
hnln commentedsub
Comment #32
Gemini-1 commentedSubscribe -
Not sure which is best patch or what it is supposed to replace in the mod.
Comment #33
bryancasler commentedPatch #29 worked for me
Comment #34
dafeder#29 worked for me.
Comment #35
Cybnext commentedCurious about the status of this patch
Comment #36
scorpjio commented#29 worked for me too.
Comment #37
Jerome F commentedPlease could you commit this?
Comment #38
martinpe commentedI second that, please commit this into your next release.
Comment #39
dddbbb commented+1
Could really do with this being committed to 7.x-3.x-dev as soon as possible.
Comment #40
paulgemini commentedWas this committed to the release today?
Comment #41
mrgoltra commentedI don't think so. I just updated and it is still there.
Comment #42
gausarts commentedsubscribing. Thanks
Comment #43
ankur commentedCommitted to the 7.x-3.x branch.
To anyone that might be testing the 7.x-4.x branch, if the same issue exists there, feel free to re-open this ticket and change the "version" number on this ticket.
Comment #45
DrCord commentedThis patch is in the version of the module I am using [7.x-3.3] and I still am experiencing this problem.