You are here

function accordion_block_get_all_blocks in Accordion Blocks 7.3

Same name and namespace in other branches
  1. 7.2 accordion_blocks.module \accordion_block_get_all_blocks()

Retriving all system blocks

@returns array of all blocks created data.

1 call to accordion_block_get_all_blocks()
accordion_block_config_settings in ./accordion_blocks.module
Implements menu callback for the admin settings form for accordion_block

File

./accordion_blocks.module, line 381

Code

function accordion_block_get_all_blocks() {
  module_load_include('inc', 'block', 'block.admin');
  static $blocksarray;
  static $theme;
  if (empty($blocksarray)) {
    global $theme_key;
    drupal_theme_initialize();
    if (!isset($theme)) {

      // If theme is not specifically set, rehash for the current theme.
      $theme = $theme_key;
    }

    // Fetch and sort blocks.
    $blocks = _block_rehash($theme);
    $compare_theme =& drupal_static('_block_compare:theme');
    $compare_theme = $theme;
    usort($blocks, '_block_compare');
    $blocksarray = array();
    foreach ($blocks as $id => $block) {
      if ($block['module'] != 'accordion_blocks') {
        $key = $block['module'] . '_delta_' . $block['delta'];
        $blocksarray[$key] = $block['info'];
      }
    }
  }
  return $blocksarray;
}