My configuration:
- Drupal 7.x
- Entity API 7.x-1.0
- Entity Connect 7.x-1.0-beta2
- Entity Reference 7.x-1.0
- Views 7.x-3.5

My Goal:
I'm trying to use Entity Connect combined with Entity Reference and Views to create a single user referencing interface which allows registered users to reference other users, but if they don't already exist in the database, also allows them to be created in a streamline fashion.

Ideally, when the referencing occurs, I'd prefer to have the ability to search each user by either their First Name, First Name AND OR Middle Name, First Name AND OR Last Name, Last Name ONLY, Middle Name only, or all three at once. I wasn't able to get this to work on the Views page, so I settled for only using the last name to key off of. So this is okay, but I still can't get the view to be used by the field at all. When I type in a name, nothing pops up (despite using a last name, username, first name, etc. that I know is a registered user).

Field Information:
The field name that allows users to reference other registered users or create them is called "field_product_foobar_contacts". It's being used in a product page content type. This field has the following settings -

  1. Display Entity Connect "edit" button. = YES
  2. Display Entity Connect "add" button. = YES
  3. # of Values = Unlimited
  4. Target Type = USER
  5. View used to select the entities = The view I created: foobar_contacts_search_filter - Entity Reference
  6. On this same page, I did not indicate any arguments nor did I tell this field to use the view to generate that view list.

So that's the field... Here's what I have for my view:

$view = new view();
$view->name = 'foobar_contacts_search_filter';
$view->description = 'This view is used to show foobar Contacts associated with products.';
$view->tag = 'default';
$view->base_table = 'users';
$view->human_name = 'foobar Contacts Search Filter';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'foobar Contacts Search Filter';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'access user profiles';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['hide_empty'] = TRUE;
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['exclude'] = TRUE;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
/* Field: User: First Name */
$handler->display->display_options['fields']['field_first_name']['id'] = 'field_first_name';
$handler->display->display_options['fields']['field_first_name']['table'] = 'field_data_field_first_name';
$handler->display->display_options['fields']['field_first_name']['field'] = 'field_first_name';
$handler->display->display_options['fields']['field_first_name']['label'] = '';
$handler->display->display_options['fields']['field_first_name']['element_label_colon'] = FALSE;
/* Field: User: Middle Name */
$handler->display->display_options['fields']['field_middle_name']['id'] = 'field_middle_name';
$handler->display->display_options['fields']['field_middle_name']['table'] = 'field_data_field_middle_name';
$handler->display->display_options['fields']['field_middle_name']['field'] = 'field_middle_name';
$handler->display->display_options['fields']['field_middle_name']['label'] = '';
$handler->display->display_options['fields']['field_middle_name']['element_label_colon'] = FALSE;
/* Field: User: Last Name */
$handler->display->display_options['fields']['field_last_name']['id'] = 'field_last_name';
$handler->display->display_options['fields']['field_last_name']['table'] = 'field_data_field_last_name';
$handler->display->display_options['fields']['field_last_name']['field'] = 'field_last_name';
$handler->display->display_options['fields']['field_last_name']['label'] = '';
$handler->display->display_options['fields']['field_last_name']['element_label_colon'] = FALSE;
/* Sort criterion: User: Last Name (field_last_name) */
$handler->display->display_options['sorts']['field_last_name_value']['id'] = 'field_last_name_value';
$handler->display->display_options['sorts']['field_last_name_value']['table'] = 'field_data_field_last_name';
$handler->display->display_options['sorts']['field_last_name_value']['field'] = 'field_last_name_value';
$handler->display->display_options['sorts']['field_last_name_value']['order'] = 'DESC';
$handler->display->display_options['sorts']['field_last_name_value']['expose']['label'] = 'Last Name (field_last_name)';
/* Contextual filter: User: Last Name (field_last_name) */
$handler->display->display_options['arguments']['field_last_name_value']['id'] = 'field_last_name_value';
$handler->display->display_options['arguments']['field_last_name_value']['table'] = 'field_data_field_last_name';
$handler->display->display_options['arguments']['field_last_name_value']['field'] = 'field_last_name_value';
$handler->display->display_options['arguments']['field_last_name_value']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['field_last_name_value']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['field_last_name_value']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['field_last_name_value']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['field_last_name_value']['limit'] = '0';
/* Filter criterion: User: Active */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'users';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'foobar-contacts-search-filter';

/* Display: Entity Reference */
$handler = $view->new_display('entityreference', 'Entity Reference', 'entityreference_1');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'entityreference_style';
$handler->display->display_options['style_options']['search_fields'] = array(
'field_first_name' => 'field_first_name',
'field_middle_name' => 'field_middle_name',
'field_last_name' => 'field_last_name',
'name' => 0,
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['inline'] = array(
'field_first_name' => 'field_first_name',
'field_middle_name' => 'field_middle_name',
'field_last_name' => 'field_last_name',
);
$handler->display->display_options['row_options']['hide_empty'] = TRUE;
$handler->display->display_options['defaults']['row_options'] = FALSE;

Any idea what's causing this to not work? Again, all I'm trying to do here is make this Entity Reference field search via last name. Since this field defaulted to making the users reference everything by username, I had to create this "Search via Last Name" view and plug that into this field to search and add users via last name.

Any help / insight into this is greatly appreciated and I apologize if this isn't the right place for this.

Comments

wolf_22’s picture

Turns out that the patch on the following page fixes this for the node create page but NOT the display: http://drupal.org/node/1791914

Now all we need is to figure out a way to have what the View keys from be displayed on the node's final page...

rooby’s picture

So you are saying that the view that returns the entity reference results is not working?

If so that has nothing to do with the entity connect module.

MM10’s picture

Wolf_22
Was there a solution for this?

jygastaud’s picture

Status: Active » Closed (won't fix)

Looks not an issue from Entityconnect and issue linked by Wolf_22 is closed.