|  | @@ -76,7 +76,12 @@ class entityreference_plugin_display extends views_plugin_display {
 | 
											
												
													
														|  |        foreach ($style_options['search_fields'] as $field_alias) {
 |  |        foreach ($style_options['search_fields'] as $field_alias) {
 | 
											
												
													
														|  |          if (!empty($field_alias)) {
 |  |          if (!empty($field_alias)) {
 | 
											
												
													
														|  |            // Get the table and field names for the checked field
 |  |            // Get the table and field names for the checked field
 | 
											
												
													
														|  | -          $field = $this->view->query->fields[$this->view->field[$field_alias]->field_alias];
 |  | 
 | 
											
												
													
														|  | 
 |  | +          if (empty($this->view->field[$field_alias]->field_info)) 
 | 
											
												
													
														|  | 
 |  | +            $field = $this->view->query->fields[$this->view->field[$field_alias]->field_alias];
 | 
											
												
													
														|  | 
 |  | +          else {
 | 
											
												
													
														|  | 
 |  | +            $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
 |  |            // Add an OR condition for the field
 | 
											
												
													
														|  |            $conditions->condition($field['table'] . '.' . $field['field'], $value, 'LIKE');
 |  |            $conditions->condition($field['table'] . '.' . $field['field'], $value, 'LIKE');
 | 
											
												
													
														|  |          }
 |  |          }
 |