search_query_alter.module

Same filename in other branches
  1. 9 core/modules/search/tests/modules/search_query_alter/search_query_alter.module
  2. 8.9.x core/modules/search/tests/modules/search_query_alter/search_query_alter.module
  3. 10 core/modules/search/tests/modules/search_query_alter/search_query_alter.module

File

core/modules/search/tests/modules/search_query_alter/search_query_alter.module

View source
<?php


/**
 * @file
 * Test module that alters search queries.
 */
declare (strict_types=1);
use Drupal\Core\Database\Query\AlterableInterface;

/**
 * Implements hook_query_TAG_alter().
 *
 * Tags 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

Title Deprecated Summary
search_query_alter_query_search_node_search_alter Implements hook_query_TAG_alter().

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