I'm currently facing an issue:
By following the contrib module's(menu_link_attributes) functionality, I altered the menu item's form to have a visibility by path option(almost the same as in the block config form).
I am saving the input data from the form in the menu_link_content's options column, then unsetting the menu item in hook_preprocess_HOOK() if the conditions are met.
The thing is, we have cached pages which are basically nodes(only on dev environment, the local one works as expected because caching is disabled) and the menu item is unset only after a CC.
I'm trying to add a cache tag to the node so that it's invalidated after I'm done with menu items.
/**
* Implements hook_preprocess_HOOK().
*/
function prl_menu_item_visibility_preprocess_node(&$variables) {
// Since all the pages are nodes and all of them are using footer menu, we add the menu_link_content cache tag and invalidate it
// when a link is saved and supposed to be hidden on specific pages.
$variables['#cache']['tags'][] = 'menu_link_content';
}
Unfortunately, no success.