view->render($this->display->id); } function render() { if (!empty($this->view->result) || !empty($this->view->style_plugin->definition['even empty'])) { return $this->view->style_plugin->render($this->view->result); } return ''; } function uses_exposed() { return FALSE; } function query() { $options = $this->get_option('references_options'); // Play nice with View UI 'preview' : if the view is not executed through // _*_reference_potential_references_views(), don't alter the query. if (empty($options)) { return; } // Make sure the id field is included in the results, and save its alias // so that references_plugin_style can retrieve it. $this->id_field_alias = $this->view->query->add_field($this->view->base_table, $this->view->base_field); // Restrict on the incoming string, or incoming ids. if ($options['string'] !== '') { switch ($options['match']) { case 'equals': $operator = '='; $value = $options['string']; break; case 'starts_with': $operator = 'LIKE'; $value = db_like($options['string']) . '%'; break; case 'contains': default: $operator = 'LIKE'; $value = '%' . db_like($options['string']) . '%'; break; } //BEGIN EDITS if (isset($this->view->display['references_1'])) { foreach($this->view->display['references_1']->handler->handlers['field'] as $key=>$field) { if (isset($field->field_info) && isset($field->field_info['storage']) && isset($field->field_info['storage']['details']) && isset($field->field_info['storage']['details']['sql']) && isset($field->field_info['storage']['details']['sql']['FIELD_LOAD_CURRENT'])) { $custom_table_info = $field->field_info['storage']['details']['sql']['FIELD_LOAD_CURRENT']; if($key != $options['title_field']) { if(is_array($custom_table_info)) { $custom_table_alias = key($custom_table_info); $custom_title = $custom_table_info[$custom_table_alias]['value']; } $table_alias = $this->view->query->ensure_table($custom_table_alias); $this->view->query->add_where('ac_conds', $custom_table_alias . '.' . $custom_title, $value, $operator); } } } $this->view->query->where['ac_conds']['type'] = 'OR'; } else { $table_alias = $this->view->query->ensure_table($this->view->base_table); $this->view->query->add_where(NULL, $table_alias . '.' . $options['title_field'], $value, $operator); } //END EDITS } elseif ($options['ids']) { $table_alias = $this->view->query->ensure_table($this->view->base_table); $this->view->query->add_where(NULL, $table_alias . '.' . $this->view->base_field, $options['ids'], 'IN'); } } }