After installing and uninstalling this module standard noderef fields become dependent of it.

"This content type has inactive fields. Inactive fields are not included in lists of available fields until their modules are enabled."

These noderef fields never used Nodereference Quantifier.

In detail: The content_node_field_instance table in the db gets changed at all nodereference fields.

The field in the table 'widget_module got change for some reason from nodereference to nodereference _quantifier, although i did not change any field properties.

Thanks for the work finding this out. Better set the project status to dev!

Comments

smokris’s picture

Title: Destroying my DB » nodereference_quantifier.module takes over nodereference.module's widgets

Confirmed --- this is happening for me, too. Enabling nodereference_quantifier causes all existing nodereference fields to break.

In nodereference_quantifier.module, there's this code:

function nodereference_quantifier_widget_info() {
  // simply wrap around existing nodereference widgets
  $widgets = nodereference_widget_info();
  foreach ($widgets as &$widget) {
    $widget['field types'][] = 'nodereference_quantifier';
  }
  return $widgets;
}

...which redefines all of nodereference.module's widgets, effectively making all the existing nodereference.module widgets belong to nodereference_quantifier.module. This strikes me as a bad idea --- now CCK knows about two sets of widgets with the same names from two different modules.

I think this nodereference_quantifier.module should reimplement the nodereference.module widgets, instead of hijacking them. Or it might be possible to extend them by implementing hook_widget_settings_alter().

smokris’s picture

Hmm, actually you can't do it with hook_widget_settings_alter(). However, there's a pending issue for CCK to better handle alterations: #998838: Make CCK field, widget and formatter can alter.

If you apply the patch on #4 of that issue to CCK, then do this instead:

function nodereference_quantifier_widget_info_alter(&$module_widgets, $module) {
  if ($module === 'nodereference') {
    foreach ($module_widgets as &$widget) {
      $widget['field types'][] = 'nodereference_quantifier';
    }
  }
}

...and accordingly change nodereference_quantifier_widget_settings() to nodereference_quantifier_widget_settings_alter(), you can get partway there: the settings form works, and nodereference.module's fields aren't obliterated.

However there doesn't seem to be a way to alter some other module's widget.

rkarajgi’s picture

@smokris ..I am having same problem - this module code is breaking the existing nodereference usage in the site. I do not want to patch the CCK but accomplish this functionality. You suggested in #1 that nodereference_quantifier.module should reimplement the nodereference.module widgets. Can you elaborate a bit more? Do you have a patch for that? Thanks

smokris’s picture

@rajeev: I meant, copy the relevant functions implemented in nodereference.module and rename them and edit the code as necessary. (Duplicating code is unfortunate, but sometimes it's the only practical way...)

See also this module I recently published --- http://drupal.org/project/nodereference_views_multifield --- which does something similar to nodereference_quantifier but using a different technique (which doesn't require a CCK patch).

rkarajgi’s picture

@smorkis : Thanks for the update. I will check it out.

gstout’s picture

We at GlobalPost are excited about this module but not sure that I see a reason to high jack the existing noderef widget when you can just offer another VERY similar cck widget option. There is no harm in having two as far as I can see. We aren't looking to retroactively alter the 1000s of noderefs we have in place but instead use this field for future/new and specific Noderef's where a little extra info is needed.

Just my big fat two cents. Its your baby, do what you want.

gstout’s picture

Issue summary: View changes

detailed bug report

Gomu’s picture

I also wasted a few hours with all node reference fields broken after uninstalling this module. Finally with the help of the comment #1, I went to the database and in the table content_node_field_instance I changed all the widget_module which were 'nodereference_quantifier' to 'nodereference'. Then everything started working again.

Gomu’s picture

Issue summary: View changes

Typo