I'm trying to use theme-preprocess-menu(&$variables) to get an additional variable into the menu template in my sub-theme, but it isn't in the commented out list of functions in the sub-theme's generated theme file, and doesn't work when I add it in.
I have also tried theme-preprocess-menu__main(&variables) following the theme hook suggestion in Twig debug, but this too doesn't work.
In all cases, I have flushed the cache.
Have I missed enabling this hook somewhere as it is used in at-core?
Update: It seems that the hook ISworking, but the code I am using to add to $variables is not affecting the array. However, the same code in preprocess_node works?
Is there any reason why this would work in one preprocess hook, but not another?
$variables['my_key'] = 'My value';
Comments
Comment #2
gurrmag CreditAttribution: gurrmag commentedComment #3
Jeff Burnz CreditAttribution: Jeff Burnz commentedYou'll have to show all your code, cheers.
Comment #4
Jeff Burnz CreditAttribution: Jeff Burnz commentedComment #5
Jeff Burnz CreditAttribution: Jeff Burnz commentedNo feedback.