Closed (fixed)
Project:
Node Reference URL Widget
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 May 2009 at 22:35 UTC
Updated:
8 Aug 2009 at 23:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
eaton commentedTweaked version that splits the actual link-building into a helper function. This would allow other modules to display the links in a sidebar block or some custom location.
Comment #2
eaton commentedAs an extra bonus, this version of the patch works.
Comment #3
quicksketchI really like the functionality added by this patch.
It looks like this patch introduces redundant options. There's no need for "Create a link on referenceable content" if there are options for "Show on teaser" and "Show on full view". We should consolidate these into a single set of checkboxes such as:
It also seems like the additional new function can't actually be called by other modules to display the link in some custom location, because the teaser and full node view check is still within that function, so if both teaser and full node view links are disabled, it won't return a link. I think a more appropriate function signature would probably omit the $teaser variable entirely and pass in the $node and $field:
And then a separate function for creating a straight-up link such as:
Comment #4
eaton commentedFreshly rewritten, pretty much the way you outline. I'd like to take a moment to shake a fist at the difference between a field and a field instance, but it all sorts itself out in the end!
Comment #5
eaton commentedComment #6
quicksketchGetting there... we need to update the validation code in nodereference_url_node_link_validate() since the 'enabled' value no longer exists. This change also requires a hook_update_N() function to change the existing variables on sites, lest this module will suddenly stop working on all existing sites after updating.
Comment #7
eaton commentedRough version, but it's a stake in the ground -- update function and corrected boolean checks. Woot.
Comment #8
eaton commentedNope, that version didn't work. Doh!
The attached one should, though. In the meantime, I've learned about CCK update functions. Yay!
Comment #9
eaton commentedComment #11
eaton commentedSome final tweaks - properly sets the 'destination' key, and sets the update to 6001, not 6006 -- I did a few rounds of testing on it and had to keep incrementing the update function locally.
Comment #12
quicksketchNice! That's one clean looking update function. I'll test this out when I get a chance.
Comment #13
mattiasj commentedVery nice feature!
Comment #14
danSamara commentedPatch works great. Thanx!
Comment #15
Mark Theunissen commentedI have applied the patch, the update went ahead without error and the functionality works as described. Thanks!
Comment #16
niklp commentedI'm gonna apply this sucka, because I want & need the shiny that appears in eaton's video: http://www.lullabot.com/articles/photo-galleries-views-attach
Edit: looks to be working fine after some *basic* testing (my specific use case only) - however I do think the text in the "return path" selector is a bit flaky. It needs to be clearer what each of these cases is. Myself, I'd assumed that the "page the link was clicked on" meant the same as the "node being referenced" and in my case it wasn't altogether clear which I ought to pick. Given that trial & error with fields isn't simple, I think this requires a little attention :)
Comment #17
eaton commentedAny suggestions on what wording would be clearer? "The page the link was clicked on" could be a listing view, the front page, or any other place that the referenced node appears. For example, let's say you have a view at the url "galleries", and node 1 is a gallery. On the "gallery" page you click a link to create a new image in gallery 1.
"Default" means you would stay on the newly posted node's page.
"Referenced node" means you would be taken to node/1, the gallery node.
"Page the link was clicked on" means you would be taken back to "galleries", because you were on that page when you clicked the link.
Comment #18
borisbarowski commentedthis module works fine, should be in the next release! :)
"Default" could be "No redirect"?
"Page the link was clicked on" could be "Previous page"?
thanks for this code, excellent functionality
Comment #19
robertdouglass commented+1 to the wordings in #18.
Comment #20
Apollo610 commentedI'm sympathetic to anyone on Windows who find the patching process a bit tedious - so if anyone needs the patched version of the .module and .install files, I'm including them in this attachment.
Comment #21
quicksketchA couple things I've found so far:
- nodereference_url_update_6001 should be nodereference_url_update_6100.
- The "Fallback behavior" value is lost on upgrade.
- The $teaser variable is not available in the nodereference_url_build_link() function, meaning that teaser is always evaluated to FALSE (so the full page setting actually controls the teaser setting).
I'm working on a reroll, but I'm a little sad that this has been RTBC for nearly 2 months, yet there are rather critical problems with the patch. :-(
Comment #22
quicksketchDoh, scratch "The "Fallback behavior" value is lost on upgrade," that was cause by my attempts in another patch to get autocomplete working.
Comment #23
quicksketchAlrighty, I applied this patch with the following changes:
- Renamed update to nodereference_url_update_6100(), since this is an update function with the 1.x branch (usually 600x is reserved for upgrading from Drupal 5).
- The $teaser variable is passed into nodereference_url_build_link(), so the "Create link on teaser" checkbox now works.
- I used most of Boris's suggestion from #18. The options are now "The new node (no redirect)", "The referenced node", and "Previous page".
- In the update function, the $field['widget']['node_link']['enabled'] option is unset, since this setting is no longer used.
- Clarified docs slightly and grouped all the link settings within a fieldset rather than #type = 'item'.
- The link title validation was broken by the change, it's now required again if either the teaser or full link option is enabled.