A function class to represent a join and create the SQL necessary to implement the join.

This is the Delegation pattern. If we had PHP5 exclusively, we would declare this an interface.

Extensions of this class can be used to create more interesting joins.

join definition

  • table: table to join (right table)
  • field: field to join on (right field)
  • left_table: The table we join to
  • left_field: The field we join to
  • type: either LEFT (default) or INNER
  • extra: An array of extra conditions on the join. Each condition is either a string that's directly added, or an array of items:
  • - table: If not set, current table; if NULL, no table. If you specify a table in cached definition, Views will try to load from an existing alias. If you use realtime joins, it works better.
  • - field: Field or formula in formulas we can reference the right table by using %alias

    • - operator: defaults to =
  • - value: Must be set. If an array, operator will be defaulted to IN.
  • - numeric: If true, the value will not be surrounded in quotes.
  • - extra type: How all the extras will be combined. Either AND or OR. Defaults to AND.


Expanded class hierarchy of views_join

See also


Related topics


core/modules/views/includes/handlers.inc, line 1002
Defines the various handler objects to help build and display views.


Contains filters are case sensitive
Name Modifiers Type Descriptionsort descending
views_join::build_join function Build the SQL for the join this object represents.
views_join::construct function Construct the views_join object.