Exemplo n.º 1
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)
{
    static $list;
    $output = '';
    $list = module_exists('context') && function_exists('context_block_list') ? context_block_list($region) : block_list($region);
    // Allow theme functions some additional control over regions
    if ($list) {
        $registry = theme_get_registry();
        if (isset($registry['blocks_' . $region])) {
            $output .= theme('blocks_' . $region, $list);
        } else {
            foreach ($list as $key => $block) {
                $output .= theme("block", $block);
            }
            $output .= drupal_get_content($region);
        }
        return $output;
    }
    return '';
}
Exemplo 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);
}