I've been trying to write a hook to selectively disable an item based on a custom query. I've using content_taxonomy with a node create form so I'm not creating my own widget by hand. Looking at the API docs I realise I should be able to write my own hook in a custom module to override particular functions but I'm having problems getting my custom versions called.
The hook I'm using is hook_hierarchical_select_valid_item, and specifically as I'm using content_taxonomy I've tried naming my function both custommodule_hs_content_taxonomy_hierarchical_select_valid_item and custommodule_hierarchical_select_valid_item but neither seems to have any effect.
I've tried all the usual cache clearing malarkey with no luck. I've resorted to using some jQuery to achieve a simila effect but I'd like to do this properly so that it also works for non-javascript using visitors.
Any thoughts? Thanks in advance!
George
Comments
Comment #1
dpearcefl commentedI've hit the same issue. After putting a bunch of dpm code in and looking at the code itself, no where do I see anything like a module_implements() loop to find all of the hook_hierarchical_select_valid_item() functions and then call these hooks. The only places this hook is called (via module_invoke()) is against the hs_taxonomy_views module. (I'm using that module.
Shouldn't hook_hierarchical_select_valid_item() be called from other custom modules?
Comment #2
dpearcefl commentedBTW, I'm running the latest dev code.
Comment #3
wim leersYou'd have to alter the hs_content_taxonomy module or duplicate it and then change hs_content_taxonomy_hierarchical_select_valid_item.
It should *not* be called for other custom modules.
Comment #4
dpearcefl commentedSo this hook is not an "open" hook, meaning only HS can use it. Seems like it might be desirable to give custom code the ability to veto the inclusion of options if need be.
My thoughts...