-
Notifications
You must be signed in to change notification settings - Fork 1
Creating a Search Provider
To create a search provider, make a table with the required fields and register it using GlobalSearchAPI:RegisterProvider like so. The provider can have any ID, but AddonName_ProviderID is recommended to avoid id collisions.
GlobalSearchAPI:RegisterProvider("AddonName_ProviderID", YourSearchProvider)name is required. It should be localized if necessary. This will be displayed in the options UI. It's not an error to have more than one provider with the same name in case some languages use the same word for different providers, but please avoid duplicate names whenever possible.
description is optional. If provided, this will be the tooltip for the entry in Enabled Search Providers. It should provide at least enough info so that the user can decide whether or not they want it enabled.
optionsTable is optional. This is an AceConfig-3.0 options table to display in the Provider Options section of the options UI.
Get is required. This function should return an array of SearchItem. It will be called every time the search bar is opened, so if it's expensive to create this array, caching it is recommended.
| Field | Required | Description |
|---|---|---|
id |
id should be unique per search provider. If it is set, the id will be used to keep track of the item for recent items. Otherwise, it will not appear in recent items. |
|
name |
X | Name to display in the listing. |
texture |
X | Texture ID or path to use for the icon. For more complicated cases, this can be a function and the Texture will be passed as the first argument. |
extraSearchText |
This text won't be displayed anywhere, but it will be included in the full text search. | |
action |
Function to run when enter is pressed. Either action or macroText is required. |
|
macroText |
Macro to run when enter is pressed. This should be used for performing protected actions. Either macroText or action is required. |
|
pickup |
Function to pick up the item. For example, PickupItem. | |
tooltip |
String to use as tooltip text, or a function to set the tooltip text. If a function is used, the tooltip is passed as the first parameter. Only functions that set tooltip text will be available. See the entire list here: https://github.com/Oppzippy/GlobalSearch/blob/master/Internal/LimitedTooltip.lua | |
hyperlink |
This will be put in the chat edit box when shift clicked. If not provided, the name will be used. |