AxuItemMenus AddTestHook
From WoWWiki
<< AxuItemMenus
This article is a part of the documentation of the AxuItemMenus function library
-- Function: -- AxuItemMenus_AddTestHook(test_func, menuinfo) -- -- Parameters: -- test_func: a function that returns true, -- if the menuinfo should be added -- menuinfo: a standard info table for UIDropDownMenu_AddButton() -- -- Returns: -- handle: a handle you can use to remove the hook
The test_func is used to decide if this menu option should be added to the menu. Create a function that returns true only if the menu option has some relevance to both the item in question and the situation where the menu is opened.
For example, it doesn't make sense to add the menu option "send item via email" if the player isn't at a post box, or the option "auction this item" if the player isn't at the auction house.
The test_func isn't given any parameters when it's called. You should use the global AxuItemMenus_C, AxuItemMenus_I, AxuItemMenus class and AxuItemMenus this variables as parameters.
The test function shouldn't be too CPU intensive, because it is run every time the player opens the menu.
The menuinfo contains the data required to create the menu option into the pop-up menu.
The function returns an opaque handle that can be used to remove this test (for example if your AddOn is disabled) using AxuItemMenus RemoveTestHook().
