Definition join on field and where other field has value I am building a views plugin and I need it to do this:

LEFT JOIN my_table mt ON (mt.nid = node.nid AND mt.value = 'some argument');


I have found documentation for creating a views plugin, but all of the documentation that I have found doesn't say anything about creating view joins like this.

Is it possible? If so, how do I go about doing something like this?
Drupal has an extra field in the join in which you can inject the extra where conditions, you can get to it by using a views_query_alter:

function my_module_views_query_alter(&amp;$view, &amp;$query) {
    if ($view-&gt;name === 'my_view' &amp;&amp; $view-&gt;current_display === 'the_display') {
        $args = $view-&gt;args[0];
        $query-&gt;table_queue['my_joined_table']['join']-&gt;extra = array(
            array(
                'value' =&gt; $args, // pass the args through
                'numeric' =&gt; FALSE, // or true if it is
                'field' =&gt; 'the_field',
                'operator' =&gt; '='
            ),
        );
    }
}