Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Solved by adding an or checking for an empty view.
@@ -812,7 +812,7 @@ function _nodereference_potential_references($field, $string = '', $match = 'con
}
// If the view doesn't exist, we got FALSE, and fallback to the regular 'standard mode'.
- if ($references === FALSE) {
+ if ($references === FALSE || empty($references)) {
$references = _nodereference_potential_references_standard($field, $string, $match, $ids, $limit);
}
Comment | File | Size | Author |
---|---|---|---|
#2 | cck-nodereference-fix-for-views-2225991-2.patch | 1.23 KB | artkon |
#1 | cck-nodereference-fix-for-views-2225991-1.patch | 638 bytes | artkon |
Comments
Comment #1
artkon CreditAttribution: artkon commentedComment #2
artkon CreditAttribution: artkon commentedFixed patch above, the nodereference was returning all nodes when the view return empty, for our use case the important thing was to pass validation when the site admin was saving the node, attached is patch for that.