function quiz_question_query_alter in Quiz 7.5
Implements hook_query_alter().
Remove questions from search.
File
- question_types/
quiz_question/ quiz_question.module, line 459 - Quiz Question module.
Code
function quiz_question_query_alter(QueryAlterableInterface $query) {
if (!variable_get('quiz_index_questions')) {
if ($types = array_keys(quiz_question_get_info())) {
$tables = $query
->getTables();
foreach ($tables as $table) {
if ($table['table'] == 'search_index' && isset($tables['node'])) {
// Remove the quiz node types from the query.
$query
->condition("{$tables['node']['alias']}.type", $types, 'NOT IN');
}
}
}
}
}