You are here

function quickbar_footer in Quickbar 6

Implementation of hook_footer()

File

./quickbar.module, line 213

Code

function quickbar_footer($main = 0) {
  $links = '';
  if (quickbar_is_enabled()) {

    // Declare initial variables.
    global $user;

    // Need a serialized array for default value.
    $roles = unserialize(variable_get('quickbar_role_weights', ''));
    if (is_array($roles)) {

      // Sort roles
      asort($roles);

      // Loop through the roles looking for a role that matches the current users
      // role and also has a menu associated with it.
      foreach ($roles as $rid => $weight) {
        if (!empty($user->roles[$rid]) && ($menu = variable_get('quickbar_' . $rid, 0))) {

          // If the toolbar should be sticky add a sticky class to the body.
          if (variable_get('quickbar_sticky_' . $rid, FALSE)) {
            $body_classes[] = 'quickbar-sticky';
          }

          // Obtain links for the menu items and theme them.
          $links = quickbar_menu_tree($menu);
          $links = theme('quickbar', $links, $rid);
          break;
        }
      }
    }
  }
  return $links;
}