You are here

search_query_alter.module in Drupal 8

Test module that alters search queries.

File

core/modules/search/tests/modules/search_query_alter/search_query_alter.module
View source
<?php

/**
 * @file
 * Test module that alters search queries.
 */
use Drupal\Core\Database\Query\AlterableInterface;

/**
 * Implements hook_query_TAG_alter(): tag search_$type with $type node_search.
 */
function search_query_alter_query_search_node_search_alter(AlterableInterface $query) {

  // For testing purposes, restrict the query to node type 'article' only.
  $query
    ->condition('n.type', 'article');
}

Functions

Namesort descending Description
search_query_alter_query_search_node_search_alter Implements hook_query_TAG_alter(): tag search_$type with $type node_search.