You are here

function ultimenu_block_get_blocks_by_region in Ultimenu 7

A helper function to generate a list of blocks from a specified region.

Parameters

array $region: The string identifier for a Ultimenu region. e.g. "ultimenu_main_about"

Return value

array The renderable array of blocks within the region.

1 call to ultimenu_block_get_blocks_by_region()
ultimenu_build_data_region in ./ultimenu.module
Build a renderable array for Ultimenu regions.

File

includes/ultimenu.utilities.inc, line 376
Misc functions that hardly change.

Code

function ultimenu_block_get_blocks_by_region($region) {
  $build = array();
  if ($blocks = block_get_blocks_by_region($region)) {
    $build = $blocks;
  }
  if (function_exists('context_get_plugin') && ($context = context_get_plugin('reaction', 'block'))) {
    if ($context_block_list = $context
      ->block_list($region)) {

      // Workaround the $context->block_get_blocks_by_region() issue.
      // Ref. https://drupal.org/node/966768
      $fixed_context_block_list = _block_render_blocks($context_block_list);
      $blocks_context = _block_get_renderable_array($fixed_context_block_list);
      $build = array_merge($blocks_context, $build);
    }
  }
  return $build;
}