You are here

function _footermap_render in footermap: a footer site map 5.2

Same name and namespace in other branches
  1. 6 footermap.module \_footermap_render()

Render function for footermap

Return value

string A string containing HTML to be inserted

2 calls to _footermap_render()
footermap_block in ./footermap.module
Implementation of hook_block
footermap_footer in ./footermap.module
Declare footer hook

File

./footermap.module, line 163
This module queries the menu for pages and makes a dynamic sitemap at the bottom of the page.

Code

function _footermap_render() {

  /* base mid changed to '0' in 5.x? */

  /* is there a way of getting this dynamically in 4.x and 5.x consistently? */
  $mapref = array();
  $avail_menus = array();
  if (variable_get('footer_cache', 0) == 0) {
    $vartime = cache_get('variables', 'cache')->created;
    $o = cache_get('footermap', 'cache');
  }
  if (isset($o->data) && $o->created >= $vartime) {
    return $o->data;
  }
  unset($o);
  $tmp_menus = variable_get('avail_menus', array(
    'Primary links',
  ));
  foreach ($tmp_menus as $key => $val) {
    if (!is_numeric($val)) {
      $avail_menus[$val] = $val;
    }
  }
  footermap_get_menu(variable_get('top_menu', variable_get('menu_primary_menu', 0)), 1, variable_get('recurse_limit', 0), $mapref, 0, $avail_menus);

  //     $x = footermap_get_menu(variable_get('top_menu',variable_get('menu_primary_menu', 0)),0,1,$mapref,variable_get('recurse_limit',0));
  foreach ($mapref as $block) {

    // we need to do this because theme() can do links or not links, not a mix of either for menu_headers...
    if (variable_get('menu_headers', 0) == 1) {

      // menu_headers enabled?
      foreach ($block as $item) {
        if ($item['href'] == '') {

          // find an empty path
          $o .= footermap_theme_map($block, array(
            'class' => 'footermap-submenu',
          ), array(
            'class' => 'links footermap-item',
          ));
          break;
        }
      }
    }
    else {
      $o .= theme('links', $block, array(
        'class' => 'links footermap-item',
      ));
    }
  }
  $o = "<div class=\"footermap\">\n" . $o . "\n</div>\n";
  if (variable_get('footer_cache', 0) == 0) {
    cache_set('footermap', 'cache', $o, CACHE_TEMPORARY);
  }
  return $o;
}