Skip to main content

Multiple joins in a custom views handler field query

Back-end Development
Drupal
function query() {
    $this->ensure_my_table();
    
    $join = new views_join();
    $join->construct('simple_workflow_node_map', $this->table_alias, $this->view->base_field, 'nid');
    $original_table = $this->query->add_table('simple_workflow_node_map', $this->relationship, $join, 'wf1');
    
    $join = new views_join();
    $join->construct('simple_workflow_node_map', $this->table_alias, $this->view->base_field, 'new_nid');
    $new_table = $this->query->add_table('simple_workflow_node_map', $this->relationship, $join, 'wf2');
    
    $this->query->add_field(
		$original_table, 
		'nid', 
                'origin_nid'
    );
}

 

Need a fresh perspective on a tough project?

Let’s talk about how RDG can help.

Contact Us