code: def horizon_dashboard_nav(context):
      
      if 'request' not in context:
          return {}
      dashboard = context['request'].horizon['dashboard']
      panel_groups = dashboard.get_panel_groups()
      non_empty_groups = []
  
      for group in panel_groups.values():
          allowed_panels = []
          for panel in group:
              if (callable(panel.nav) and panel.nav(context) and
                      panel.can_access(context)):
                  allowed_panels.append(panel)
              elif (not callable(panel.nav) and panel.nav and
                      panel.can_access(context)):
                  allowed_panels.append(panel)
          if allowed_panels:
              if group.name is None:
                  non_empty_groups.append((dashboard.name, allowed_panels))
              else:
                  non_empty_groups.append((group.name, allowed_panels))
  
      return {'components': OrderedDict(non_empty_groups),
              'user': context['request'].user,
              'current': context['request'].horizon['panel'].slug,
              'request': context['request']}
docs: Generates sub-navigation entries for the current dashboard.