Esempio n. 1
0
/**
 * Helper function that builds the nested lists of a nice menu.
 *
 * @param $menu
 *   Menu array from which to build the nested lists.
 */
function lullacog_nice_menu_build($menu)
{
    // Retrieve original path so we can repair it after our hack.
    $original_path = $_GET['q'];
    if (function_exists('context_active_values')) {
        // Retrieve the first active menu path found.
        $active_paths = context_active_values('menu');
        if (!empty($active_paths)) {
            $path = current($active_paths);
            if (menu_get_item($path)) {
                menu_set_active_item($path);
            }
        }
    }
    $output = theme_nice_menu_build($menu);
    menu_set_active_item($original_path);
    return $output;
}
Esempio n. 2
0
/**
 * Override of theme_blocks().
 * Allows additional theme functions to be defined per region to
 * control block display on a per-region basis. Falls back to default
 * block region handling if no region-specific overrides are found.
 */
function tao_blocks($region)
{
    // Bail if this region has been disabled through context.
    if (module_exists('context')) {
        $disabled_regions = context_active_values('theme_regiontoggle');
        if (!empty($disabled_regions) && in_array($region, $disabled_regions)) {
            return '';
        }
    }
    $output = '';
    $list = module_exists('context') && function_exists('context_block_list') ? context_block_list($region) : block_list($region);
    if (!empty($list)) {
        // Allow theme functions some additional control over regions
        $registry = theme_get_registry();
        if (isset($registry['blocks_' . $region])) {
            return theme('blocks_' . $region, $list);
        }
        // Otherwise, flow through regular stack
        foreach ($list as $key => $block) {
            $output .= theme("block", $block);
        }
    }
    return $output . drupal_get_content($region);
}