function footermap_render in footermap: a footer site map 7
1 call to footermap_render()
File
- ./
footermap.module, line 163
Code
function footermap_render() {
global $user;
global $language;
$recurse = variable_get('recurse_limit', 0);
$base = variable_get('top_menu', 0);
$menus = menu_get_menus(TRUE);
$mapref = array();
$avail_menus = variable_get('avail_menus', array());
$o = '';
$i = 1;
foreach ($menus as $key => $menu) {
if (isset($avail_menus[$key]) && $avail_menus[$key] === $key) {
$mapref[$key] = array(
'#theme' => 'footermap_header',
'#title' => $menu,
// Need to check_plain() or t() during render.
'#attributes' => array(
'class' => array(
'footermap-col',
'footermap-header',
),
'id' => 'footermap-col-' . $i,
),
'#attached' => array(
'css' => array(
drupal_get_path('module', 'footermap') . '/footermap.css',
),
),
);
$i++;
}
}
// Setup the render array first without any map reference set.
$content = array(
'#theme' => 'footermap',
'#footermap' => '',
'#title' => '',
'#cached' => FALSE,
);
// Custom block cache per language
$lang = !empty($user->language) ? $user->language : (!empty($language->language) ? $language->language : LANGUAGE_NONE);
$cached = cache_get('footermap-' . $lang, 'cache');
// Set cached to true if we're cached and overwrite our map reference.
if (isset($cached->data)) {
$mapref = $cached->data;
$content['#cached'] = TRUE;
}
else {
footermap_get_menu($base, $mapref, $recurse, 0);
}
// Finally set the map reference in the render array.
$content['#footermap'] = $mapref;
return $content;
}