Example #1
0
/**
 * Implements hook_block_list_alter().
 */
function omega_block_list_alter(&$blocks)
{
    if (omega_extension_enabled('layouts') && ($layout = omega_layout())) {
        $callers = debug_backtrace();
        // Check if drupal_alter() was invoked from _block_load_blocks(). This is
        // required as we do not want to interfere with contrib modules like ctools.
        if ($callers['2']['function'] === '_block_load_blocks') {
            // In case we are currently serving a Omega layout we have to make sure
            // that we don't process blocks that will never be shown because the
            // active layout does not even have a region for them.
            foreach ($blocks as $id => $block) {
                if (!array_key_exists($block->region, $layout['info']['regions'])) {
                    unset($blocks[$id]);
                }
            }
        }
    }
    // Hide the main content block on the front page if the theme settings are
    // configured that way and there is no content set to override the homepage.
    $front = variable_get('site_frontpage', 'node');
    if ($front == 'node' && !omega_theme_get_setting('omega_toggle_front_page_content', TRUE) && drupal_is_front_page()) {
        foreach ($blocks as $key => $block) {
            if ($block->module == 'system' && $block->delta == 'main') {
                unset($blocks[$key]);
            }
        }
        drupal_set_page_content();
    }
}
/**
 * Implements hook_block_list_alter().
 */
function omega_block_list_alter(&$blocks)
{
    if (omega_extension_enabled('layouts') && ($layout = omega_layout())) {
        // In case we are currently serving a Omega layout we have to make sure that
        // we don't process blocks that will never be shown because the active layout
        // does not even have a region for them.
        foreach ($blocks as $id => $block) {
            if (!array_key_exists($block->region, $layout['info']['regions'])) {
                unset($blocks[$id]);
            }
        }
    }
    // Hide the main content block on the front page if the theme settings are
    // configured that way.
    if (!omega_theme_get_setting('omega_toggle_front_page_content', TRUE) && drupal_is_front_page()) {
        foreach ($blocks as $key => $block) {
            if ($block->module == 'system' && $block->delta == 'main') {
                unset($blocks[$key]);
            }
        }
        drupal_set_page_content();
    }
}