Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / search / tests / modules / search_embedded_form / search_embedded_form.module
1 <?php
2
3 /**
4  * @file
5  * Test module implementing a form that can be embedded in search results.
6  *
7  * A sample use of an embedded form is an e-commerce site where each search
8  * result may include an embedded form with buttons like "Add to cart" for each
9  * individual product (node) listed in the search results.
10  */
11
12 /**
13  * Adds the test form to search results.
14  */
15 function search_embedded_form_preprocess_search_result(&$variables) {
16   $form = \Drupal::formBuilder()->getForm('Drupal\search_embedded_form\Form\SearchEmbeddedForm');
17   $variables['snippet'] = array_merge($variables['snippet'], $form);
18 }