This would be really awesome, if you could use both of these together thanks.

CommentFileSizeAuthor
#2 noderefcreate-fallback-951822-2.patch1.45 KBimclean
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

imclean’s picture

Title: Integrate with node reference url? » Integrate with Node Reference Create
Project: Node Reference Create » Node Reference URL Widget
Version: 6.x-1.0 » 6.x-1.11

Sounds good. Should nodereference_url specifically support noderefcreate? As you've not received any response here I'll move it to the noderefence_url issue queue to see if there's any support. I'll have a look into it but would also like to know if this is the best way to go about it.

imclean’s picture

Title: Integrate with Node Reference Create » Fallback to Node Reference Create autocomplete
Version: 6.x-1.11 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
1.45 KB

Here's a stab at it.

chertzog’s picture

applying the patch hides the field on the node create form. It also shows "Referenced content not found." when displayed in a block with formblock (http://drupal.org/project/formblock).

Its not passing this function:


function _nodereference_url_process($element, $edit, $form_state, $form) {
  if (isset($element['#value']) && is_numeric($element['#value']) && ($node = node_load($element['#value']))) {
    $element['#display_title'] = check_plain($node->title);
  }
  
  else {
    $element['#display_title'] = t('Referenced content not found.');
  }

  $element['nid'] = array(
    '#type' => 'value',
    '#value' => isset($element['#value']) ? $element['#value'] : $element['#value'],
    '#parents' => $element['#parents'],
  );

  return $element;
}
chertzog’s picture

Status: Needs review » Needs work

Its also not allowing the field to be edited when "use fallback for editing" is checked.

imclean’s picture

chertzog, it works for me both on the node create form and when "use fallback for editing" is checked. What versions of noderefcreate and nodereference_url are you using? Presumably you've set set the fallback option to "Node Reference Create: Autocomplete text field with create". Do the other options all work?

I haven't used formblock. Does nodereference_url work with it without the patch?

chertzog’s picture

Status: Needs work » Needs review

After re-downloading both modules, and re-applying the patch, it decided to work. I think is probably an error in my manual application of the patch.

All is good. Thanks for the patch!

JustMagicMaria’s picture

I could really use this patch for the 7.x version as well.

imclean’s picture

Trailing whitespace aside, is there anything fundamentally wrong with this approach?

@JustMagicMaria, have you tried the 6 version yet? Does it work for you? This really needs some feedback for it to get anywhere.

donapis’s picture

Need this patch for 7.x also. Thanks

donapis’s picture

bump