Spin off from #1145766: Notice: Undefined index: args in _node_reference_view_settings_validate() (line 159 of …/node_reference/node_reference.module)

nodereference_url_build_link() uses calls _node_reference_potential_references(), which signature was just changed by #945004: [release blocker] Missing views-mode for picking userreference and nodereference :-/.

Sorry about that, I wasn't aware that some external code was relying on the function.
I'll be rolling a beta release for references shortly, it should then be "easier" to fix nodereference_url accordingly point to an official references tag.

Comments

yched’s picture

references-7.x.2.0-beta2 is out (I fixed a small bug just after tagging beta1, so we release straight to beta2)

quicksketch’s picture

Thanks for the heads-up yched. Yeah we shouldn't have been calling it to begin with, so that's what we get for using a private function.

yched’s picture

Then again, I guess you had little other choices. There's currently no official API func to figure out if a node is in the scope of a noderef field :-(.

Apart from breaking APIs further, I guess we could promote _node_reference_potential_references() to the outside facing API.

jerdavis’s picture

StatusFileSize
new1.2 KB

Here's a patch

quicksketch’s picture

Hm, this is going to be ugly. @yched has there been a final release of this change yet? Promoting it to a public function or at least changing its name would make upgrading easier for users if we could do an if function_exists() check and use differently named functions.

yched’s picture

@quicksketch : I did not make that change yet without hearing from you first.

references-beta2 only contains the new signature for _node_reference_potential_references().

If we want to go that way, I can issue a new beta3 shortly that contains a new, non-underscored node_reference_potential_references(), and the old one as a temporary BC measure (which would go away at some point - for instance in the final release).

On the nodereference_url side, I guess you could add a function_exists() check in the current dev, and state that your next release requires references-beta3 ?

andrebonfanti’s picture

paulandrewmarchand@yahoo.com’s picture

What do I have to change and where If I want to do this manually?

THX

quicksketch’s picture

If we want to go that way, I can issue a new beta3 shortly that contains a new, non-underscored node_reference_potential_references(), and the old one as a temporary BC measure (which would go away at some point - for instance in the final release).

I'd prefer that References project just made the change to remove the underscore and left Node Reference URL Widget to include the function_exists() hack/BC functionality. But if you're okay with including the old function signature in place, I'd be happy to take that route too, but I think just making the function public would get people off of calling this "private" function anyway and that would be a good thing.

erik’s picture

I'm experiencing this 500 internal server error as well when trying to edit a node which is referencing another node...
The error log is throwing a: PHP Fatal error: Unsupported operand types in /Users/erik/Projects/erik.butff.nl/sites/all/modules/references/node_reference/node_reference.module on line 702

rfay’s picture

Status: Active » Needs review

#4 solves the problem for me.

erik’s picture

Thank you, tried it and it works for me too!

paulandrewmarchand@yahoo.com’s picture

Sorry I am kind of new to Drupal. Can anyone tell me how to run this patch on Godaddy?

yched’s picture

jon pugh’s picture

StatusFileSize
new1.19 KB

Rerolled based on the new function name, no prefix, relative.

quicksketch’s picture

StatusFileSize
new1.75 KB

Thanks yched! Here's my backward-compatible patch until References module gets a final release. This makes it so users don't have to be plagued by API differences during the transition. If it looks okay I'll commit and put out a new release right away. Thanks guys!

yched’s picture

+++ b/nodereference_url.module
@@ -369,7 +375,13 @@ function nodereference_url_field_widget_form(&$form, &$form_state, $field, $inst
+      $reference = node_reference_potential_references($field, array('match' => 'equals', 'ids' => array($referenced_nid), 'limit' => 1));

Nitpick : 'match' is only used if matching against 'string' is passed, useless if matching against a list of 'nids'

Powered by Dreditor.

quicksketch’s picture

Status: Needs review » Fixed
StatusFileSize
new1.73 KB

Cool, I've committed this patch, thanks yched.

yched’s picture

@quicksketch : did you commit this ? It doesn't seem to appear in the commit logs ;-)

quicksketch’s picture

I'm not sure what's up with Git, the "Shortlog" doesn't include any of my recent commits:
http://drupalcode.org/project/nodereference_url.git

But the change is definitely in there in the 7.x-1.x branch:
http://drupalcode.org/project/nodereference_url.git/shortlog/refs/heads/...

I've made the 1.11 release and it will be packaged up shortly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.