I have an autocomplete for a field referencing users.

I want to search for the users full name in the autocomplete field, which is stored in 2 separate first and last name fields. I don't want to duplicate the name in a new combined field because of the numbers of users would make the already large database unnecessarily larger.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

emattias’s picture

Status: Active » Needs review
FileSize
2.89 KB

This patch adds a new "Match search fields as one combined field" option which will allow you to search for a users full name even though the name is stored in multiple fields. This is based alot on the views_handler_filter_combine filter.

emattias’s picture

Here's the same patch but now it will export the new match_fields_combined setting.

Chris Matthews’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 4 year old patch in #2 to entityreference_plugin_display.inc and entityreference_plugin_style.inc does not apply to the latest 7.x-1.x-dev and if still relevant needs a reroll.

Checking patch views/entityreference_plugin_display.inc...
error: while searching for:
            $this->view->query->add_field($this->view->field[$field_alias]->options['table'], $this->view->field[$field_alias]->real_field, $this->view->field[$field_alias]->options['field'], array());
            $field = $this->view->query->fields[$this->view->field[$field_alias]->options['field']];
          }
          // Add an OR condition for the field
          $conditions->condition($field['table'] . '.' . $field['field'], $value, 'LIKE');
        }
      }

      $this->view->query->add_where(NULL, $conditions);
    }

    // Add an IN condition for validation.

error: patch failed: views/entityreference_plugin_display.inc:84
error: views/entityreference_plugin_display.inc: patch does not apply
Checking patch views/entityreference_plugin_style.inc...