Hi
I really like the module. I created my own nodereference widget, which basically works the same as nodereference but has some additional feeds. Well, the problem is, that noderelationships works with nodereference_autocomplete only! My widget is called nodereference_autocomplete_gal ... it's not going to work unless I change something in the module. This could be solved with the following piece of code:

if (strpos($elements['#type'], 'nodereference_autocomplete') !== FALSE && isset($elements['nid']) && isset($elements['nid']['nid'])) {
      _noderelationships_element_append_class($elements['nid']['nid'], 'noderelationships-nodereference-autocomplete noderelationships['. $field_name .']');
    }

Instead of checking for an exact match it's checking if there's some nodereference_autocomplete field. This gives other widgets with the proper naming the oportunity to use the module.

I added a patch. Please review it. I would be glad if this patch would get into the module

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rapsli’s picture

... any chance for this patch to get into the module???

shushu’s picture

I would love adding new widgets support as well.
My goal is actually to support the standard select-box, so the user can select from the existing list, from the "search and reference", or create new node (and add it to the select options...).

Any chance of doing it ?
What should be my direction ?

markus_petrux’s picture

Status: Needs review » Needs work

If we want to support more types of widgets, then we need to cover then possibility to swap the javascript code related to the widget, which is used to extract the current values, and it needs to be updated, also the way the buttons are attached probably needs to be amended in some way. All this stuff needs to be covered.

scroogie’s picture

Perhaps there should be a hook that nodereference widgets would need to implement to be supported by Node Relationships, in php and Javascript.

rapsli’s picture

having some kind of hook would be easier, but just with the very simple patch, we would get pretty far.

ayalon’s picture

Sounds very interesting!

markus_petrux’s picture

Title: Support for other types of widget » Add support for derivatives of the Node Reference Autocomplete widget
Version: 6.x-1.5 » 6.x-1.x-dev
Status: Needs work » Needs review
FileSize
3.79 KB

hmm... let's see if the following patch can solve this problem for all modules that may need to reuse Node Relationships extras for derivatives of the Node Reference Autocomplete widget.

markus_petrux’s picture

I have marked #979526: Integration with nodereference url widget as a duplicate. I'd like to find the same solution for both issues.

markus_petrux’s picture