function taxonomy_nodes_test_query_node_access_alter

Implements hook_query_TAG_alter().

1 string reference to 'taxonomy_nodes_test_query_node_access_alter'
TaxonomyTermTestCase::testTaxonomySelectNodesAlter in modules/taxonomy/taxonomy.test
Tests that taxonomy term detail page is working even after the default taxonomy_select_nodes() query is altered.

File

modules/simpletest/tests/taxonomy_nodes_test.module, line 11

Code

function taxonomy_nodes_test_query_node_access_alter(QueryAlterableInterface $query) {
    if (variable_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');
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.