0

I have been able to successfully create a search plugin for a custom module, which allows users to search for my custom entity by name. After creating this file, I have to enable it by visiting /admin/config/search/pages selecting my search type from the dropdown, and add it after specifying the target path. What is needed to do this within the module? I imagine I would have to create a route somewhere, and then associate this route with the search page list. Any advice on how to do it?

1 Answer 1

1

After you've configured the plugin in UI, export the config and look for the configuration file search.page.[search_plugin_id].yml.

Remove the uuid and hash line and place the file in the directory config/optional/ of the module.

You find examples in the core modules Node and User, see http://cgit.drupalcode.org/drupal/tree/core/modules/user/config/optional/search.page.user_search.yml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.