1 taxonomy_nodes_test.module taxonomy_nodes_test_query_node_access_alter(QueryAlterableInterface $query)

Implements hook_query_TAG_alter().

File

core/modules/taxonomy/tests/taxonomy_nodes_test/taxonomy_nodes_test.module, line 10
Dummy module implementing hook_query_TAG_alter.

Code

function taxonomy_nodes_test_query_node_access_alter(QueryAlterableInterface $query) {
  if (state_get('taxonomy_nodes_test_query_node_access_alter', FALSE)) {
    $taxonomy_index = FALSE;
    foreach ($query->getTables() as $alias => $table) {
      if ($table['table'] == 'taxonomy_index') {
        $taxonomy_index = TRUE;
      }
    }

    if ($taxonomy_index) {
      // Verify that additional data can be added to the default
      // taxonomy_select_nodes() query by altering it.
      $query->leftJoin('taxonomy_term_data', 'ttd', 'ttd.tid = t.tid');
    }
  }
}