function d8cache_preprocess_links in Drupal 8 Cache Backport 7
Implements hook_preprocess_links().
File
- includes/
menu.inc, line 27 - Menu functions and hooks for the D8 caching system backport.
Code
function d8cache_preprocess_links(&$variables) {
$tag_map = array();
if (isset($variables['links'])) {
foreach ($variables['links'] as $link) {
if (isset($link['#menu_name'])) {
$tag_map['menu:' . strtr($link['#menu_name'], '-', '_')] = TRUE;
}
}
drupal_add_cache_tags(array_keys($tag_map));
}
}