You are here

function _authcache_menu_tab_root_type_map_load in Authenticated User Page Caching (Authcache) 7.2

Utility function: Load map of tab_roots -> type.

Return value

array A list of tab root paths of pages where personalization of tabs and actions respectively is necessary.

1 call to _authcache_menu_tab_root_type_map_load()
authcache_menu_tab_root_blacklist in modules/authcache_menu/authcache_menu.module
Return tab_roots where tabs may differ for users with the same role set.

File

modules/authcache_menu/authcache_menu.module, line 177
Authcache support for menu, tabs and local actions.

Code

function _authcache_menu_tab_root_type_map_load() {
  $type_map =& drupal_static(__FUNCTION__);
  if (!isset($type_map)) {
    $query = db_select('menu_router', 'm')
      ->fields('m', array(
      'tab_root',
      'type',
    ))
      ->distinct();
    $invars = module_invoke_all('authcache_menu_invariant_access_callbacks');
    drupal_alter('authcache_menu_invariant_access_callbacks', $invars);
    foreach ($invars as $cb) {
      $query
        ->condition('access_callback', $cb, '<>');
    }
    $result = $query
      ->execute()
      ->fetchAll();
    $type_map = array();
    foreach ($result as $row) {
      $type = (int) $row->type;
      if (empty($type_map[$row->tab_root])) {
        $type_map[$row->tab_root] = $type;
      }
      else {
        $type_map[$row->tab_root] |= $type;
      }
    }
  }
  return $type_map;
}