You are here

function quotes_block_join_sql in Quotes 7

Same name and namespace in other branches
  1. 5 quotes.module \quotes_block_join_sql()
  2. 6 quotes.module \quotes_block_join_sql()

Adds the necessary joins to a quotes block query to support filter criteria.

Parameters

array $filters: The array specifying filter criteria using the keys rid_filter and tid_filter.

string $query: The query object to modify.

Return value

string The modified query containing any SQL joins necessary for the provided criteria.

1 call to quotes_block_join_sql()
quotes_get_quote in ./quotes.module
Returns random quote or the most recent quote ID based on filter criteria.

File

./quotes.module, line 1861
The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.

Code

function quotes_block_join_sql($filters = array(), $query) {
  if (!empty($filters['rid_filter']) && $filters['rid_filter'] != 'none') {
    $ur_alias = $query
      ->leftjoin('users_roles', 'a', 'uid');
  }
  if (!empty($filters['tid_filter']) && $filters['tid_filter'] != 'none') {
    $ttn_alias = $query
      ->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
  }
  return $query;
}