You are here

function mongodb_block_get_renderable_array in MongoDB 7

Gets an array of blocks suitable for drupal_render().

Parameters

array $list: A list of blocks such as that returned by block_list().

Return value

array A renderable array.

See also

_block_get_renderable_array()

1 call to mongodb_block_get_renderable_array()
mongodb_block_page_build in mongodb_block/mongodb_block.module
Implements hook_page_build().

File

mongodb_block/mongodb_block.module, line 255
Controls the visual building blocks a page is constructed with.

Code

function mongodb_block_get_renderable_array(array $list = []) {
  global $theme;
  $weight = 0;
  $build = [];
  foreach ($list as $key => $block) {
    $build[$key] = $block->content;
    unset($block->content);

    // Add contextual links for this block; skip the main content block, since
    // contextual links are basically output as tabs/local tasks already. Also
    // skip the help block, since we assume that most users do not need or want
    // to perform contextual actions on the help block, and the links needlessly
    // draw attention on it.
    if (module_exists('mongodb_block_ui') && $key != 'system_main' && $key != 'system_help') {
      $build[$key]['#contextual_links']['mongodb_block_ui'] = [
        'admin/structure/mongodb_block/manage',
        [
          $theme,
          $block->module,
          $block->delta,
        ],
      ];
    }
    $build[$key] += [
      '#block' => $block,
      '#weight' => ++$weight,
    ];
    $build[$key]['#theme_wrappers'][] = 'block';
  }
  $build['#sorted'] = TRUE;
  return $build;
}