search_embedded_form.module
Same filename in other branches
- 7.x modules/search/tests/search_embedded_form.module
- 9 core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module
- 10 core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module
- 11.x core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module
Test module implementing a form that can be embedded in search results.
A sample use of an embedded form is an e-commerce site where each search result may include an embedded form with buttons like "Add to cart" for each individual product (node) listed in the search results.
File
-
core/
modules/ search/ tests/ modules/ search_embedded_form/ search_embedded_form.module
View source
<?php
/**
* @file
* Test module implementing a form that can be embedded in search results.
*
* A sample use of an embedded form is an e-commerce site where each search
* result may include an embedded form with buttons like "Add to cart" for each
* individual product (node) listed in the search results.
*/
/**
* Adds the test form to search results.
*/
function search_embedded_form_preprocess_search_result(&$variables) {
$form = \Drupal::formBuilder()->getForm('Drupal\\search_embedded_form\\Form\\SearchEmbeddedForm');
$variables['snippet'] = array_merge($variables['snippet'], $form);
}
Functions
Title | Deprecated | Summary |
---|---|---|
search_embedded_form_preprocess_search_result | Adds the test form to search results. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.