class SearchEmbeddedFormThemeHooks
Theme hook implementations for search_embedded_form module.
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.
Hierarchy
- class \Drupal\search_embedded_form\Hook\SearchEmbeddedFormThemeHooks
Expanded class hierarchy of SearchEmbeddedFormThemeHooks
File
-
core/
modules/ search/ tests/ modules/ search_embedded_form/ src/ Hook/ SearchEmbeddedFormThemeHooks.php, line 17
Namespace
Drupal\search_embedded_form\HookView source
class SearchEmbeddedFormThemeHooks {
public function __construct(protected FormBuilderInterface $formBuilder) {
}
/**
* Implements hook_preprocess_HOOK().
*/
public function preprocessSearchResult(&$variables) : void {
$form = $this->formBuilder
->getForm('Drupal\\search_embedded_form\\Form\\SearchEmbeddedForm');
$variables['snippet'] = array_merge($variables['snippet'], $form);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
SearchEmbeddedFormThemeHooks::preprocessSearchResult | public | function | Implements hook_preprocess_HOOK(). |
SearchEmbeddedFormThemeHooks::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.