Simple hierarchical select is used to display Taxonomy as a select field in my existing content type. So I'm trying to alter the value of it. Even tried using hook_form_alter
but didn't work. So is there any way or hook using which I can alter the value of the select list?
1 Answer
Finally, I was able to resolve it by using the module handler "shs_term_data_response". Like below
function YourModuleName_shs_term_data_response_alter(&$content, $context) {
$termList = json_decode($content);
$filteredList = array();
/..your logic to modify $termList and push it to new array.../
$content = json_encode($filteredList);
}
Hope it may help someone :)
hook_form_alter
. Maybe you can paste the code that didn't work so we may have a look at it. Maybe you have to ensure yourhook_form_alter
implementation runs last (aftershs
) viahook_module_implements_alter
. Hard to tell with that little info.