One character patch to location module to get rid of senseless too many empty locations error
Working on the Trade Justice "site sprint" to launch this long-running and ambitious project...
alaken: I just tried to import a CCK node type from my site, and got "You can't show more empty location forms than the maximum number of locations allowed for this content type." - you know what causes this? There is no location stuff in my import.
[11:02pm] benjamin-agaric: i do see it all the time on this site from the location module
[11:02pm] benjamin-agaric: did it kill your import?
[11:02pm] alaken: yea
[11:02pm] benjamin-agaric: it's because location *can* be added to every node type
[11:02pm] benjamin-agaric: directly, not as a field
[11:02pm] alaken: but I can do it by hand if need be
[11:02pm] alaken: yea, I get that, but why the error?
[11:03pm] benjamin-agaric: and that collapsed fieldset (or whatever it is represented as in a programmatic import, heh)
[11:03pm] benjamin-agaric: has a default value
[11:03pm] benjamin-agaric: that location's own node type save validation
[11:03pm] benjamin-agaric: considers illegal
[11:04pm] alaken: I think we have a misconfiguration. When I try to add a new type in the UI, I get this:
[11:04pm] alaken: http://skitch.com/alaken/69ne/content-types-global-justice
[11:04pm] benjamin-agaric: again, it isn't *our* misconfiguration
[11:05pm] benjamin-agaric: but one baked into the module
[11:05pm] benjamin-agaric: certainly worth patching
[11:05pm] alaken: and if you try to submit form with those defaults you get error.
[11:05pm] benjamin-agaric: one second
[11:05pm] benjamin-agaric: exactly
[11:05pm] alaken: So the "0, 0, 3" parameters are hard-coded?
[11:06pm] alaken: they are? dumb.
[11:07pm] benjamin-agaric: yes they are, as defaults
[11:07pm] benjamin-agaric: i think the bigger error is in the validation
[11:07pm] alaken: defaults that are invalid on save? dumb.
[11:07pm] benjamin-agaric: but the fix is easier to make it all zeros
[11:08pm] alaken: can we?
[11:08pm] benjamin-agaric: i just did
[11:08pm] alaken: where? I looked before...
[11:10pm] alaken: I don't like how location does this. I'd prefer a config page where you choose which content types it's enabled for. On the ones where it's not enabled, it does NOTHING. Don't other modules that alter nodes work that way?
[11:10pm] benjamin-agaric: there's a mix
[11:10pm] alaken: I hate having that big fieldset for every node type even if you only have 1 that's locative-enabled.
[11:11pm] benjamin-agaric: since so little is done on a node type edit form these days (all the action is in fields), it's not so unreasonable to have a lot of options there.
This error had already been annoying me, but at least when manually creating or editing a node type, it was just a validation error that took an extra second to set all fields to zero. But now it was blocking import, so I set all fields to zero in the code!
alaken: so where did you change those defaults? Couldnt find it.
[11:19pm] benjamin-agaric: http://drupal.org/files/issues/location-more_empty_locations-338963.patch
[11:19pm] benjamin-agaric: sorry, alaken -- i wanted to answer your question *right*
[11:19pm] benjamin-agaric: http://drupal.org/node/338963#comment-1162413