Version 1
[yaffs-website] / web / core / modules / search / tests / modules / search_query_alter / search_query_alter.module
diff --git a/web/core/modules/search/tests/modules/search_query_alter/search_query_alter.module b/web/core/modules/search/tests/modules/search_query_alter/search_query_alter.module
new file mode 100644 (file)
index 0000000..aee8e6c
--- /dev/null
@@ -0,0 +1,16 @@
+<?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');
+}